Android 65536问题

Android Studio解决办法

android {

    compileSdkVersion 21
    buildToolsVersion '21.1.0'

    defaultConfig {
       ...
       targetSdkVersion 21
       multiDexEnabled true // 多dex解决65536问题
   }
}

虽然解决了65536问题,但是还会有

Execution failed for task ':app:transformClassesWithDexForDebug'.

的问题,这是由于项目太大,JVM heap值不够造成的,解决办法:

android {
//snip
//add this into your existing 'android' block
    dexOptions {
        javaMaxHeapSize "4g"
    }
//snip
}

转自:https://metova.com/blog/dev/overhead-limit-exceeded/

原文地址:https://www.cnblogs.com/a0000/p/5309405.html