Skip to content

Update Android Manifest

d.eshenko edited this page Oct 26, 2022 · 6 revisions

⚡ Before you start
Make sure you have correctly Include Android.


AndroidManifest template

If you do not find the manifest file Plugins/Android/AndroidManifest.xml, you can take it from the example.
Or Unity 2019.3+ makes it possible to activate in Player Settings > Publishing Settings > Build > Custom Main Manifest checkmark.

Update for Android 12

If your app targets Android 12, then you must explicitly declare the android:exported attribute. For all changes in Android 12, see Behavior changes in Android 12
Add the android:exported="true" attribute to the <activity> tag to Assets/Plugins/Android/AndroidManifest.xml:

<application ...>
  <activity android:name="com.unity3d.player.UnityPlayerActivity"
            android:theme="@style/UnityThemeSelector"
            android:exported="true">
    <intent-filter>
      <action android:name="android.intent.action.MAIN" />
       <category android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
     <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
   </activity>
</application>

Included permissions in SDK

Sometimes permissions are included in the partner SDK’s internal AndroidManifest.
To remove a specific embedded permission (for example, ACCESS_COARSE_LOCATION), add the following tag to your top level AndroidManifest during integration:

<manifest>
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove"/>
</manifest>

🔗 Done! What’s Next?

Clone this wiki locally