Android Build: Dex Jumbo Mode in Gradle

2019-01-16 17:54发布

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?

6条回答
放荡不羁爱自由
2楼-- · 2019-01-16 18:21

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.

查看更多
做自己的国王
3楼-- · 2019-01-16 18:24

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楼-- · 2019-01-16 18:29

Modify build.gradle in your module to add:

android {
    dexOptions {
        jumboMode = true
    }
}

After that run gradle clean in your project root

查看更多
Emotional °昔
5楼-- · 2019-01-16 18:36

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

查看更多
孤傲高冷的网名
6楼-- · 2019-01-16 18:40

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

查看更多
倾城 Initia
7楼-- · 2019-01-16 18:42

You can modify your build.gradle file to include:

android {
    dexOptions {
        jumboMode = true
    }
}
查看更多
登录 后发表回答