Category

Tutorial

Enable Multidex on Unity (without Android Studio)

First of all, you have some plugins to download:

  • Download .pom and .aar files here:https://mvnrepository.com/artifact/com.android.support/multidex/1.0.2
  • Download .pom and .aar files for multidex-instrumentation here:https://mvnrepository.com/artifact/com.android.support/multidex-instrumentation/1.0.2
  • Create folders …\m2repository\com\android\support\multidex-instrumentation\1.0.2 and …\m2repository\com\android\support\multidex\1.0.2 and copy corresponding .pom and .aar there.

Next step is to update your Android Manifest and added android:name=”android.support.multidex.MultiDexApplication” on the Application node.

Now, you’ll have to activate the Multidex support on Unity, go to Build Settings, Android, Player Settings, in Publish settings check the “Custom Gradle Template”, it’ll generate a mainTemplate.gradle on the Plugin/Android folder.

 

Note, if it’s not a new project, you’ll have to manage the gradle template with your old one (generated automaticaly on temp/GradleOUT).

Now you’ll have to add two things on your gradle template:

    • Add compile ‘com.android.support:multidex:1.0.2’ on Dependencies
    • ‘multiDexEnabled true’ on defaultConfig