If you are having multidex issues with your Android builds, configure and enable your app for multidex. Multidex errors occur if the minSdkVersion that your app supports is set to earlier than API 21 (Android 5.0).
To resolve multidex errors in your project, complete the following steps:
- Open your project in the Unity Editor and go to Project Settings > Player > Publish settings.
- Enable the Custom Launcher Manifest and Custom Launcher Gradle Template.
- Open your Custom Launcher Manifest (located in Assets/plugins/Android), go to the application tag, and then add the following:
android:name="androidx.multidex.MultiDexApplication"
The following is an example of how your Application tag will look after this addition:
<application android:label="@string/app_name"
android:icon="@mipmap/app_icon"
android:name=”androidx.multidex.MultiDexApplication"/>
- Open your Custom Launcher Gradle Template (located in Assets/plugins/Android), go to the dependencies section (not the buildscript dependencies), and then add the following:
implementation "androidx.multidex:multidex:2.0.1"
The following is an example of how your dependencies section will look after this addition:
dependencies {
implementation project(':unityLibrary')
implementation "androidx.multidex:multidex:2.0.1"
- In the Android.defaultconfig section of the Gradle template file, add the following:
multiDexEnabled true
The following is an example of how your defaultconfig section will look after this addition:
defaultConfig {
multiDexEnabled true
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
After you update these files, your application will be supported as a multidex application. If the issue persists, you can also delete the Temp folder inside of your Android project.
For more information, see the Unity Mediation documentation.