0

So it is already known that the solution to this error:

com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded

Is to enable multidex support. I have done so, as well as applying proguard shrinking, but still get that error. Is there also a limit for multidex (presumably much higher than 64k)?

I am using several huge libraries, but it'd be nice to know the answer to this before somehow re-engineering everything to use fewer libraries. (I'm porting a desktop app to Android.)

1

1 Answer 1

1

The solution to that particular error message is not to enable multi-dex support. The error appears when multi-dex support is enabled, but the build system determined that too many methods need to be added to the main dex file for your app to work.

Depending on your Android Gradle plugin version you might be affected by this bug which causes too many methods to be included in the main dex file. The solution is to upgrade to Android Gradle plugin 2.2 or newer, and build tools 24 or newer.

If that does not solve the problem, you might indeed have to many (transitive) method dependencies in your main activities onCreate() code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.