What is dex in Gradle(Gradle 中的 dex 是什么)
问题描述
Gradle 或 Android 中的 dex 是什么?
What is the dex in Gradle or in Android?
在Gradle中,dexoptions
是什么意思?
In Gradle, what's the meaning of dexoptions
?
有时我的项目由于某些 dexerrors 而无法编译.我需要激活 ProGuard 来编译我的 Android 应用程序.
Sometimes my project does not compile because of some dexerrors. I need to activate ProGuard to compile my Android app.
推荐答案
在标准的java世界中:
当您编译标准 java 代码时:编译器生成 *.class 文件.*class 文件包含可以在标准 JVM 上执行的标准 java 字节码.
In the standard java world:
When you compile standard java code : the compiler produce *.class file. A *class file contains standard java bytecode that can be executed on a standard JVM.
这是不同的.您使用 java 语言编写代码,但编译器不生成 *.class 文件,它生成 *.dex 文件.*.dex
文件包含可以在 Android 虚拟机 (dalvik) 上执行的字节码,这不是标准的 Java 虚拟机.
It is different. You use the java language to write your code, but the compiler don't produce *.class files, it produce *.dex file. A *.dex
file contains bytecode that can be executed on the Android Virtual Machine (dalvik) and this is not a standard Java Virtual Machine.
明确一点:android 中的 dex 文件相当于标准 java 中的 class.
To be clear: a dex file in android is the equivalent of class in standard java.
所以 dexoptions
是一个 gradle 对象,其中定义了一些配置此 java-code-to-android-bytecode 转换的选项.通过这个对象配置的选项是:
So dexoptions
is a gradle object where some options to configure this java-code-to-android-bytecode transformation are defined. The options configured via this object are :
- 目标API级别
- force-jumbo 模式(启用后允许 dex 文件中包含更多字符串)
启用 jumboMode
:
android {
dexOptions {
jumboMode = true
}
}
这篇关于Gradle 中的 dex 是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Gradle 中的 dex 是什么


- Android viewpager检测滑动超出范围 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01