Learn how to resolve common issues when developing Android applications using Unity.
When building a Unity Android application, the final application manifest might contain permissions that you didn’t explicitly add to your project. Such unexpected permissions might cause issues when you want to distribute your application through distribution services, such as the Play Store.
The application manifest contains unexpected permission entries that aren’t part of your project’s manifest files.
When building a Unity Android application, GradleAn Android build system that automates several build processes. This automation means that many common build errors are less likely to occur. More info
See in Glossary generates the final application manifest by merging manifest files from various sources including plug-insA set of code created outside of Unity that creates functionality in Unity. There are two kinds of plug-ins you can use in Unity: Managed plug-ins (managed .NET assemblies created with tools like Visual Studio) and Native plug-ins (platform-specific native code libraries). More info
See in Glossary and packages. This process might automatically include certain unexpected permissions in the manifest based on the dependencies and the target SDK version.
To identify and resolve such unexpected permissions, use the manifest merger log file that Gradle generates when you build your Android application. This log file provides information on how and why Gradle adds each manifest element. Follow these steps:
Build your application in .apk or .aab format.
Go to the logs directory under <your_project>/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/outputs.
Open the appropriate log file based on the build type.
Look for log entries that start with IMPLIED to identify unexpected permissions. The log file displays information as follows:
IMPLIED from D:\MyProject\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\src\main\AndroidManifest.xml:2:1-5:12 reason: com.test.package has a targetSdkVersion < 4
uses-permission#android.permission.READ_PHONE_STATE
Check the reason field to identify the cause of the unexpected permission. In this example, the log entry indicates that Gradle added the uses-permission#android.permission.READ_PHONE_STATE permission because the targetSdkVersion of the com.test.package is lower than 4.
Contact the owner of the package to request updating the target SDK version to match your project’s target SDK version.