How to set up application build for Android 13
The steps to configure app builds for Android 13 (API level 33) differ depending on the version of Unity you are using.
Action | 2019 | 2020 | 2021 | 2022 | 2023 |
---|---|---|---|---|---|
Upgrade | + | + | + | + | + |
Use the Gradle 7.2 plugin | + | + | + | + | |
Change the Gradle plugin version in | + | + | + | + | |
Add META/INF exclusions to | + | + | + | + | + |
Add META/INF exclusions to | + | ||||
Change AndroidManifest | + | + | + | + | + |
Note
You can automate the setup process using post-processing scripts. For example, the AndroidFilesProcessor file.
Upgrade Target API Level to 33
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - In the
Target API Level , selectAPI Level 33
. - Start building the Android application. In the message that says that the required API is missing, click
Update Android SDK . The build process will continue after the required files have been downloaded.
Note
After downloading the API, you can change the value in the Target API Level field to the default value —
latest
.Use Gradle 7.2 plugin
- Download Gradle 7.2.
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - Go to
External Tools > Android section. - Uncheck the
Gradle installed with Unity box. - In the
Gradle field, clickBrowse and select the folder with Gradle 7.2 files.
Change Gradle plugin version in Base Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Base Gradle Template box. - Open the
Assets/Plugins/Android/baseProjectTemplate.gradle
file in a text editor. - In the dependencies section, specify the plugin version as 4.1.0, as shown in the example:
Copy
Full screen
Small screen
- groovy
classpath 'com.android.tools.build:gradle:4.1.0'
Add META/INF exclusions to Launcher Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Launcher Gradle Templatere box. - Open the
Assets/Plugins/Android/launcherTemplate.gradle
file in a text editor. - Add the following lines to the end of the file:
Copy
Full screen
Small screen
- groovy
android {
packagingOptions {
pickFirst 'META-INF/kotlinx-serialization-json.kotlin_module'
pickFirst 'META-INF/kotlinx_coroutines_core.version'
pickFirst 'META-INF/kotlinx-serialization-core.kotlin_module'
pickFirst 'META-INF/atomicfu.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx.kotlin_module'
pickFirst 'META-INF/ktor-events.kotlin_module'
pickFirst 'META-INF/ktor-websocket-serialization.kotlin_module'
pickFirst 'META-INF/ktor-serialization.kotlin_module'
pickFirst 'META-INF/ktor-client-core.kotlin_module'
pickFirst 'META-INF/ktor-io.kotlin_module'
pickFirst 'META-INF/ktor-http.kotlin_module'
pickFirst 'META-INF/ktor-client-content-negotiation.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx-json.kotlin_module'
pickFirst 'META-INF/ktor-websockets.kotlin_module'
pickFirst 'META-INF/ktor-utils.kotlin_module'
}
}
Change AndroidManifest
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Main Manifest box. - Open the
Assets/Plugins/Android/AndroidManifest.xml
file in a text editor. - Insert the following lines into the
application
tag:
Copy
Full screen
Small screen
- xml
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
- Add the
android:exported
attribute with thetrue
value to the main Activitycom.unity3d.player.UnityPlayerActivity
.
Copy
Full screen
Small screen
- xml
<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<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>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>
</manifest>
Upgrade Target API Level to 33
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - In the
Target API Level , selectAPI Level 33
. - Start building the Android application. In the message that says that the required API is missing, click
Update Android SDK . The build process will continue after the required files have been downloaded.
Note
After downloading the API, you can change the value in the Target API Level field to the default value —
latest
.Use Gradle 7.2 plugin
- Download Gradle 7.2.
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - Go to
External Tools > Android section. - Uncheck the
Gradle installed with Unity box. - In the
Gradle field, clickBrowse and select the folder with Gradle 7.2 files.
Change Gradle plugin version in Base Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Base Gradle Template box. - Open the
Assets/Plugins/Android/baseProjectTemplate.gradle
file in a text editor. - In the dependencies section, specify the plugin version as 4.1.0, as shown in the example:
Copy
Full screen
Small screen
- groovy
classpath 'com.android.tools.build:gradle:4.1.0'
Add META/INF exclusions to Launcher Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Launcher Gradle Templatere box. - Open the
Assets/Plugins/Android/launcherTemplate.gradle
file in a text editor. - Add the following lines to the end of the file:
Copy
Full screen
Small screen
- groovy
android {
packagingOptions {
pickFirst 'META-INF/kotlinx-serialization-json.kotlin_module'
pickFirst 'META-INF/kotlinx_coroutines_core.version'
pickFirst 'META-INF/kotlinx-serialization-core.kotlin_module'
pickFirst 'META-INF/atomicfu.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx.kotlin_module'
pickFirst 'META-INF/ktor-events.kotlin_module'
pickFirst 'META-INF/ktor-websocket-serialization.kotlin_module'
pickFirst 'META-INF/ktor-serialization.kotlin_module'
pickFirst 'META-INF/ktor-client-core.kotlin_module'
pickFirst 'META-INF/ktor-io.kotlin_module'
pickFirst 'META-INF/ktor-http.kotlin_module'
pickFirst 'META-INF/ktor-client-content-negotiation.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx-json.kotlin_module'
pickFirst 'META-INF/ktor-websockets.kotlin_module'
pickFirst 'META-INF/ktor-utils.kotlin_module'
}
}
Change AndroidManifest
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Main Manifest box. - Open the
Assets/Plugins/Android/AndroidManifest.xml
file in a text editor. - Insert the following lines into the
application
tag:
Copy
Full screen
Small screen
- xml
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
- Add the
android:exported
attribute with thetrue
value to the main Activitycom.unity3d.player.UnityPlayerActivity
.
Copy
Full screen
Small screen
- xml
<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<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>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>
</manifest>
Upgrade Target API Level to 33
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - In the
Target API Level , selectAPI Level 33
. - Start building the Android application. In the message that says that the required API is missing, click
Update Android SDK . The build process will continue after the required files have been downloaded.
Note
After downloading the API, you can change the value in the Target API Level field to the default value —
latest
.Use Gradle 7.2 plugin
- Download Gradle 7.2.
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - Go to
External Tools > Android section. - Uncheck the
Gradle installed with Unity box. - In the
Gradle field, clickBrowse and select the folder with Gradle 7.2 files.
Change Gradle plugin version in Base Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Base Gradle Template box. - Open the
Assets/Plugins/Android/baseProjectTemplate.gradle
file in a text editor. - In the dependencies section, specify the plugin version as 4.1.0, as shown in the example:
Copy
Full screen
Small screen
- groovy
classpath 'com.android.tools.build:gradle:4.1.0'
Add META/INF exclusions to Launcher Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Launcher Gradle Templatere box. - Open the
Assets/Plugins/Android/launcherTemplate.gradle
file in a text editor. - Add the following lines to the end of the file:
Copy
Full screen
Small screen
- groovy
android {
packagingOptions {
pickFirst 'META-INF/kotlinx-serialization-json.kotlin_module'
pickFirst 'META-INF/kotlinx_coroutines_core.version'
pickFirst 'META-INF/kotlinx-serialization-core.kotlin_module'
pickFirst 'META-INF/atomicfu.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx.kotlin_module'
pickFirst 'META-INF/ktor-events.kotlin_module'
pickFirst 'META-INF/ktor-websocket-serialization.kotlin_module'
pickFirst 'META-INF/ktor-serialization.kotlin_module'
pickFirst 'META-INF/ktor-client-core.kotlin_module'
pickFirst 'META-INF/ktor-io.kotlin_module'
pickFirst 'META-INF/ktor-http.kotlin_module'
pickFirst 'META-INF/ktor-client-content-negotiation.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx-json.kotlin_module'
pickFirst 'META-INF/ktor-websockets.kotlin_module'
pickFirst 'META-INF/ktor-utils.kotlin_module'
}
}
Change AndroidManifest
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Main Manifest box. - Open the
Assets/Plugins/Android/AndroidManifest.xml
file in a text editor. - Insert the following lines into the
application
tag:
Copy
Full screen
Small screen
- xml
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
- Add the
android:exported
attribute with thetrue
value to the main Activitycom.unity3d.player.UnityPlayerActivity
.
Copy
Full screen
Small screen
- xml
<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<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>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>
</manifest>
Upgrade Target API Level to 33
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - In the
Target API Level , selectAPI Level 33
. - Start building the Android application. In the message that says that the required API is missing, click
Update Android SDK . The build process will continue after the required files have been downloaded.
Note
After downloading the API, you can change the value in the Target API Level field to the default value —
latest
.Use Gradle 7.2 plugin
- Download Gradle 7.2.
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - Go to
External Tools > Android section. - Uncheck the
Gradle installed with Unity box. - In the
Gradle field, clickBrowse and select the folder with Gradle 7.2 files.
Change Gradle plugin version in Base Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Base Gradle Template box. - Open the
Assets/Plugins/Android/baseProjectTemplate.gradle
file in a text editor. - In the dependencies section, specify the plugin version as 4.1.0, as shown in the example:
Copy
Full screen
Small screen
- groovy
classpath 'com.android.tools.build:gradle:4.1.0'
Add META/INF exclusions to Launcher Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Launcher Gradle Templatere box. - Open the
Assets/Plugins/Android/launcherTemplate.gradle
file in a text editor. - Add the following lines to the end of the file:
Copy
Full screen
Small screen
- groovy
android {
packagingOptions {
pickFirst 'META-INF/kotlinx-serialization-json.kotlin_module'
pickFirst 'META-INF/kotlinx_coroutines_core.version'
pickFirst 'META-INF/kotlinx-serialization-core.kotlin_module'
pickFirst 'META-INF/atomicfu.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx.kotlin_module'
pickFirst 'META-INF/ktor-events.kotlin_module'
pickFirst 'META-INF/ktor-websocket-serialization.kotlin_module'
pickFirst 'META-INF/ktor-serialization.kotlin_module'
pickFirst 'META-INF/ktor-client-core.kotlin_module'
pickFirst 'META-INF/ktor-io.kotlin_module'
pickFirst 'META-INF/ktor-http.kotlin_module'
pickFirst 'META-INF/ktor-client-content-negotiation.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx-json.kotlin_module'
pickFirst 'META-INF/ktor-websockets.kotlin_module'
pickFirst 'META-INF/ktor-utils.kotlin_module'
}
}
Change AndroidManifest
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Main Manifest box. - Open the
Assets/Plugins/Android/AndroidManifest.xml
file in a text editor. - Insert the following lines into the
application
tag:
Copy
Full screen
Small screen
- xml
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
- Add the
android:exported
attribute with thetrue
value to the main Activitycom.unity3d.player.UnityPlayerActivity
.
Copy
Full screen
Small screen
- xml
<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<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>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>
</manifest>
Upgrade Target API Level to 33
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - In the
Target API Level , selectAPI Level 33
. - Start building the Android application. In the message that says that the required API is missing, click
Update Android SDK . The build process will continue after the required files have been downloaded.
Note
After downloading the API, you can change the value in the Target API Level field to the default value —
latest
.Add META/INF exclusions to Launcher Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Launcher Gradle Templatere box. - Open the
Assets/Plugins/Android/launcherTemplate.gradle
file in a text editor. - Add the following lines to the end of the file:
Copy
Full screen
Small screen
- groovy
android {
packagingOptions {
pickFirst 'META-INF/kotlinx-serialization-json.kotlin_module'
pickFirst 'META-INF/kotlinx_coroutines_core.version'
pickFirst 'META-INF/kotlinx-serialization-core.kotlin_module'
pickFirst 'META-INF/atomicfu.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx.kotlin_module'
pickFirst 'META-INF/ktor-events.kotlin_module'
pickFirst 'META-INF/ktor-websocket-serialization.kotlin_module'
pickFirst 'META-INF/ktor-serialization.kotlin_module'
pickFirst 'META-INF/ktor-client-core.kotlin_module'
pickFirst 'META-INF/ktor-io.kotlin_module'
pickFirst 'META-INF/ktor-http.kotlin_module'
pickFirst 'META-INF/ktor-client-content-negotiation.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx-json.kotlin_module'
pickFirst 'META-INF/ktor-websockets.kotlin_module'
pickFirst 'META-INF/ktor-utils.kotlin_module'
}
}
Add META/INF exclusions to Main Gradle Template
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Main Gradle Templatere box. - Open the
Assets/Plugins/Android/mainTemplate.gradle
file in a text editor. - Add the following lines to the end of the file:
Copy
Full screen
Small screen
- groovy
android {
packagingOptions {
pickFirst 'META-INF/kotlinx-serialization-json.kotlin_module'
pickFirst 'META-INF/kotlinx_coroutines_core.version'
pickFirst 'META-INF/kotlinx-serialization-core.kotlin_module'
pickFirst 'META-INF/atomicfu.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx.kotlin_module'
pickFirst 'META-INF/ktor-events.kotlin_module'
pickFirst 'META-INF/ktor-websocket-serialization.kotlin_module'
pickFirst 'META-INF/ktor-serialization.kotlin_module'
pickFirst 'META-INF/ktor-client-core.kotlin_module'
pickFirst 'META-INF/ktor-io.kotlin_module'
pickFirst 'META-INF/ktor-http.kotlin_module'
pickFirst 'META-INF/ktor-client-content-negotiation.kotlin_module'
pickFirst 'META-INF/ktor-serialization-kotlinx-json.kotlin_module'
pickFirst 'META-INF/ktor-websockets.kotlin_module'
pickFirst 'META-INF/ktor-utils.kotlin_module'
}
}
Change AndroidManifest
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android > Other Settings section. - Check the
Custom Main Manifest box. - Open the
Assets/Plugins/Android/AndroidManifest.xml
file in a text editor. - Insert the following lines into the
application
tag:
Copy
Full screen
Small screen
- xml
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
- Add the
android:exported
attribute with thetrue
value to the main Activitycom.unity3d.player.UnityPlayerActivity
.
Copy
Full screen
Small screen
- xml
<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<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>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>
</manifest>
Was this article helpful?
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.Found a typo or other text error? Select the text and press Ctrl+Enter.