The Android Manifest is an XML file which contains important metadata about the Android app. This includes the package name, activity names, main activity (the entry point to the app), Android version support, hardware features support, permissions, and other configurations.
For more information about the Android Manifest file, see the Android Developer documentation on Android Manifests.
In Unity 2019.3 and newer versions, the Android 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 project that Unity generates has two template manifest files:
When Unity builds your app, it automatically generates the Android manifest files, following the steps below:
manifmergerclass to merge plug-in manifests into the main manifest.
Although Unity generates a correct manifest for your app, you might want direct control over its contents.
To use an Android manifest you created outside of Unity, import your Android Manifest file to the following location: Assets/Plugins/Android/AndroidManifest.xml. This overrides the default LibraryManifest.xml.
In this situation, Unity merges the manifests of your Android libraries into your main manifest, and ensures that the resulting manifest’s configuration is correct. For full control of the manifest, including permissions, you must export the Project and modify the final manifest in Android Studio.
Note: Unity only supports the
[launchMode - singleTask](https://developer.android.com/guide/topics/manifest/activity-element.html#lmode) launch mode.
Unity automatically adds the necessary permissions to the manifest based on the Android Player Settings and Unity APIs that your app calls from the script. For example:
Networkclasses add the INTERNET permission
Handheld.Vibrate) adds VIBRATE
InternetReachability] property adds ACCESS_NETWORK_STATE
LocationService) adds ACCESS_FINE_LOCATION
WebCamTextureAPIs add CAMERAA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
Microphoneclass adds RECORD_AUDIO
For more information about permissions, see Android developer documentation on Android Manifest Permissions.
If your plug-ins require a permission by declaring it in their manifests, Unity automatically adds the permission to the resulting Android manifest during the merge stage. All Unity APIs that plug-ins call also contribute to the permissions list.
If your app is running on a device with Android 6.0 (Marshmallow) or later and also targets Android API level 23 or higher, your app uses the Android Runtime Permission System.
The Android Runtime Permission System asks the user to grant permissions while the app is running, instead of when they first install the app. App users can usually grant or deny each permission when the app needs it while the app is running (for example, requesting camera permission before taking a picture). This allows an app to run with limited functionality without permissions. You can use the
Android.Permission class in Unity to check whether the user granted or denied specific permissions. If a permission your app needs has been denied, you can inform the user why the app needs it and ask them to approve the permission. For more information, see documentation on Requesting Permissions.
Your app normally prompts the user to allow what Android calls “dangerous” permissions on its startup. For more information, see Android developer documentation on dangerous permissions. If you don’t want your app to ask for permissions on startup, you can add the following code to your manifest, in either the Application or Activity sections:
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
Note: This code suppresses the permission dialog the app shows on startup, but you must handle runtime permissions carefully to avoid crashes. This is an advanced method of dealing with runtime permissions.
For more information about the Runtime Permission System and handling permissions, see Android developer documentation on Requesting Permissions.
To examine the final Android manifest that Unity generates for your app, open the Temp/StagingArea/AndroidManifest.xml file after you build your Project but before you close the Unity Editor.
The Manifest is stored in binary format in the output package (.apk). To check the contents of a Manifest inside an .apkThe Android Package format output by Unity. An APK is automatically deployed to your device when you select File > Build & Run. More info
See in Glossary, you can use the Android Studio APK Analyzer, or another third-party tool such as Apktool.
Did you find this page useful? Please give it a rating: