-
Error:execution failed for task ': Ttt:transformclasseswithdexfordebug '.
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
Unfortunately, I met today, the integration of a Udesk customer service function, import its moudle, inside a mess into a lot of third-party. As a third party customer service, is this really good for you?
Solution Solutions
-
Gradle configuration: In the app's Build.gradle
android { defaultConfig { applicationId "com.xxx.xxx" minSdkVersion 14 targetSdkVersion 21 multiDexEnabled true //加上这句话 } }
-
Gradle configuration: In the app's Build.gradle
dependencies { compile ‘com.android.support:multidex:1.0.1‘ }
-
Your own application class override method:
@Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }
You can also inherit the Android.support.multidex.MultiDexApplication class without overriding the method above
-
If your app contains a referenced lirary project or moudle, you need to set the precompilation to false:
android { // ... dexOptions { preDexLibraries = false } }
-
When running, if you see the following error:
Unexpected top-level ERROR:
Java.lang.OutOfMemoryError:Java Heap Space
In Dexoptions, there is a field to increase the Java heap memory size:
android { // ... dexOptions { javaMaxHeapSize "2g" } }
Solutions for more than 65535 Android engineering methods