Android - transform Classes With Dex For Debug

。_饼干妹妹 提交于 2019-11-27 09:01:31

Adding the following code to build.gradle app module solved my problem

android{
    defaultConfig {

        // Enabling multidex support.
        multiDexEnabled true
    }


    dexOptions {
        javaMaxHeapSize "4g"
    }
}
dependencies {
    //...
    compile 'com.android.support:multidex:1.0.0'
}

you can selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:

 compile 'com.google.android.gms:play-services:8.4.0'

with these lines:

compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'

==> to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.

Adding the following in build.gradle fixed the issue for me,

android {
//...

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
//...
}

This horrendous recurring issue hit me again recently. The gradle build stalls permanently at app:transformClassesWithDexForDebug, just running for hours and never completing. This time I fixed it by removing all references to 'fabric', a new layer of Crashlytics being pushed on us.

//apply plugin: 'io.fabric'   //REMOVE
//classpath 'io.fabric.tools:gradle:1.26.1'  //REMOVE
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!