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 是什么
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
