If your Android game has surpassed the 64K method limit, you'll need to look into implementing Multidex, ProGuard or both. While ProGuard can reduce the number of methods in your application, Multidexing will split your binary in order to allow more than 64K methods.
If you haven't tried enabling ProGuard, we recommend trying that out first before enabling Multidex. You can read more about adding ProGuard to your application and its benefits in this article. If you've implemented ProGuard, and are still over the 64K method limit, then you should follow the instructions here in order to implement Multidex.
You can follow these steps in order to enable Multidex:
- Make sure that you are on at least Android SDK Build Tools 21.1
- On your
build.gradlefile (module level), enable Multidex by adding '
multiDexEnabled true'to your
- Also inside
build.gradle, add multidex as a dependency:
- In your manifest, add the MultiDexApplication class as shown below
<?xml version="1.0" encoding="utf-8"?>
When you are able to perform these steps correctly, Android build tools will create a primary DEX and support DEX files as needed. If you want to learn more about Multidex, we recommend reading this article on Android Studio.
If you have other questions that were not covered by this article, feel free to reach out to us at email@example.com