含义是什么:dexOptions内的增量,preDexLibraries,jumboMode? [英] What's the meaing of: incremental, preDexLibraries, jumboMode, inside dexOptions?

查看:96
本文介绍了含义是什么:dexOptions内的增量,preDexLibraries,jumboMode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在build.gradle内部,我们可以添加这些参数

inside build.gradle we can add that params

android {
    dexOptions {
        incremental 
        preDexLibraries
        jumboMode 
        javaMaxHeapSize
    }
}

但是文档太少

布尔增量

是否为dx启用增量模式.这有很多限制,可能无法正常工作.小心使用.

Whether to enable the incremental mode for dx. This has many limitations and may not work. Use carefully.

布尔jumboMode

boolean jumboMode

在dx(--force-jumbo)中启用巨型模式.

Enable jumbo mode in dx (--force-jumbo).

布尔preDexLibraries

boolean preDexLibraries

是否使用pre-dex库.这样可以改善增量构建,但是干净的构建可能会更慢.

Whether to pre-dex libraries. This can improve incremental builds, but clean builds may be slower.

1)哪些限制是增量的?

1) which limitations are in incremental?

2)什么是巨型模式?

2) what is jumbo mode?

3)什么是pre-dex库?

3) what is pre-dex libraries?

推荐答案

首先让我们看一下dex文件.在纯Java中,当您编译Java代码时,它将被编译成 .class 文件,而在android中,您的Java代码将被编译成 .dex 文件.(都是字节码,但不同)

first of all lets see whats dex file. in pure java when you compile the java code,it will be compiled into a .class file while in android your java code will be compiled into .dex file. (both are bytecodes but different)

incremental :这意味着Gradle将使用以前的dex文件并将新的更改附加到它们(而不是每次都重新构建它们).

incremental: it means Gradle will use previous dex file and appends the new changes to them (not building them again every time).

第一个问题的答案:例如限制之一是您不能将其与multidex *一起使用(尽管已解决了此限制-对于sdk版本,仅重建受影响的dex文件,multidex apk可以实现21+增量构建)

the answer of your first Q: e.g. one of the limitation were you couldnt use it along with multidex* (though this limitation was solved - for sdk versions 21+ incremental builds are possible for multidex apks by rebuilding only the affected dex files)

-note:您无需再担心此限制,因为自Gradle 2.1.0版本起,默认情况下增量选项为true

-note: you dont need to worry about this limitations anymore because incremental option is true by default since Gradle version 2.1.0

multidex :此选项意味着将Java代码编译到多个dex文件中,除非您的代码方法超过单个dex文件的最大限制(64k方法),否则不需要此代码

multidex: this option means compiling java code into multiple dex file you dont need this unless your code methods outnumbers the max limitation on a single dex file (64k methods)

jumboMode (第二个问题的答案):dex文件中的字符串计数也有限制,启用此选项将扩展dex文件中的字符串计数(从Gradle 2.1.0开始,此选项为true,因此您也不必为此担心)

jumboMode (the answer of your second Q): there is also a limitation for strings count in the dex file enabling this option will extend the strings count in dex file (this option is true since Gradle 2.1.0 so you dont have to worry about it either)

preDexLibraries (第三个问题的答案):它从库中构建dex文件,因此可以在增量构建中使用(并非每次都为库构建dex文件).因此在进行干净构建时使用此项目会使一切变慢.

preDexLibraries (the answer of your third Q): it builds dex file out of libraries so it can be used in incremental builds (not building dex files every time for libraries). so using this item when clean build makes everything a little slower.

这篇关于含义是什么:dexOptions内的增量,preDexLibraries,jumboMode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆