Android Build: Dex Jumbo Mode in Gradle

自古美人都是妖i 提交于 2019-11-27 05:24:03

问题


I am using following line in android ant build (project.properties):

dex.force.jumbo=true

Now we are migrating from ant to Gradle. Is it possible to get jumbo mode active in Android Gradle build?


回答1:


You can modify your build.gradle file to include:

android {
    dexOptions {
        jumboMode = true
    }
}



回答2:


Modify build.gradle in your module to add:

android {
    dexOptions {
        jumboMode = true
    }
}

After that run gradle clean in your project root




回答3:


I'm not sure if it possbile to set force jumbo in Gradle, but since Android Studio 0.2.4 you can enable it in Compiler -> Android DX Compiler -> Force Jumbo Mode.




回答4:


I was able to do this on Windows by changing the dx.bat in the build-tools and adding the --force-jumbo parameter as a default. Definitely a work around though - hopefully this will be addressed in the Gradle plugin.




回答5:


Check your build tools. Update if necessary and try again.




回答6:


this error means that your method have got over 65536

just add multiDexEnabled on default config at build.gradle file

defaultConfig {
   ...
   multiDexEnabled true
   ... 
}

this way also work: https://blog.csdn.net/H_O_W_E/article/details/77742907



来源:https://stackoverflow.com/questions/17320088/android-build-dex-jumbo-mode-in-gradle

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