Troubleshooting for Android
Solve common issues when developing for Android using Unity.
Read time 2 minutesLast updated 12 days ago
Learn how to resolve common issues when developing Android applications using Unity.
Android manifest file contains unexpected permissions
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.
Symptom
The application manifest contains unexpected permission entries that aren't part of your project's manifest files.
Cause
When building a Unity Android application, Gradle generates the final application manifest by merging manifest files from various sources including plug-ins and packages. This process might automatically include certain unexpected permissions in the manifest based on the dependencies and the target SDK version.
Resolution
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 inor
.apkformat..aab -
Go to thedirectory under
logs.<your_project>/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/outputs -
Open the appropriate log file based on the build type.
- Release build:
manifest-merger-release-report.txt - :Development build
?
manifest-merger-debug-report.txt
- Release build:
-
Look for log entries that start withto identify unexpected permissions. The log file displays information as follows:
IMPLIEDIMPLIED 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 < 4uses-permission#android.permission.READ_PHONE_STATE -
Check thefield to identify the cause of the unexpected permission. In this example, the log entry indicates that Gradle added the
reasonpermission because theuses-permission#android.permission.READ_PHONE_STATEof thetargetSdkVersionis lower thancom.test.package.4 -
Contact the owner of the package to request updating the target SDK version to match your project's target SDK version.