Hicham Pirhano Hicham Pirhano - 1 month ago 20
Java Question

DexIndexOverflowException after moving to Android Studio 2.2

I have just moved my project to Android Studio 2.2 and I am unable to generate my apk.

I got this error message :

Error:Execution failed for task ':app:transformClassesWithDexForRelease'.


com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536


What should I do to remove this error ?

Answer

Project compilation generate dex file, dex can handle until 65536 methods.

Your project compilation has over than 65536 methods, so you should improve dependencies or enable MultiDex, to split your code in more dex files

Take a look here https://developer.android.com/studio/build/multidex.html better approach to solve it in your case.

Comments