Android Plugin DSL Reference 参考文档 :
一、DexOptions#keepRuntimeAnnotatedClasses 属性配置
DexOptions ( build.gradle#android#dexOptions ) 文档位置 : https://google.github.io/android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.DexOptions.html
1、配置简介
DexOptions#keepRuntimeAnnotatedClasses 属性配置 用于设置 是否 在多 dex 文件中的 main dex 字节码中 保留 运行时注解 ;
2、配置原型
DexOptions#keepRuntimeAnnotatedClasses 属性配置 原型 : 该配置是 布尔值类型 的 ;
boolean keepRuntimeAnnotatedClasses
Keep all classes with runtime annotations in the main dex in legacy multidex.
This is enabled by default and works around an issue that will cause the app to crash when using java.lang.reflect.Field.getDeclaredAnnotations on older android versions.
This can be disabled for for apps that do not use reflection and need more space in their main dex.
See http://b.android.com/78144.
3、配置示例
DexOptions#keepRuntimeAnnotatedClasses 属性配置 示例 : 在
" build.gradle # android # dexOptions # keepRuntimeAnnotatedClasses " 中 , 配置 DexOptions#javaMaxHeapSize 属性 , 配置一个字符串即可 ;
android {
dexOptions {
additionalParameters '--multi-dex', '--minimal-main-dex', '--set-max-idx-number=5000'
javaMaxHeapSize '2048m'
jumboMode true
keepRuntimeAnnotatedClasses true
}
}
二、DexOptions#maxProcessCount 属性配置
DexOptions ( build.gradle#android#dexOptions ) 文档位置 : https://google.github.io/android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.DexOptions.html
1、配置简介
DexOptions#maxProcessCount 属性配置 用于设置 编译 dex 字节码文件时 允许的最大并发进程数 , 默认是
4
4
4 ;
2、配置原型
DexOptions#maxProcessCount 属性配置 原型 : 该配置是 Integer 整型类型 的 ;
Integer maxProcessCount
The maximum number of concurrent processes that can be used to dex. Defaults to 4.
Be aware that the number of concurrent process times the memory requirement represent the minimum amount of memory that will be used by the dx processes:
Total Memory = maxProcessCount * javaMaxHeapSize
To avoid thrashing, keep these two settings appropriate for your configuration.
3、配置示例
DexOptions#maxProcessCount 属性配置 示例 : 在
" build.gradle # android # dexOptions # maxProcessCount " 中 , 配置 DexOptions#maxProcessCount 属性 , 配置一个 整型 即可 ;
android {
dexOptions {
additionalParameters '--multi-dex', '--minimal-main-dex', '--set-max-idx-number=5000'
javaMaxHeapSize '2048m'
jumboMode true
keepRuntimeAnnotatedClasses true
maxProcessCount 4
}
}
|