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:
The following is an example of how your Application tag will look after this addition:
- 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:
The following is an example of how your dependencies section will look after this addition:
- In the Android.defaultconfig section of the Gradle template file, add the following:
The following is an example of how your defaultconfig section will look after this addition:
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.