Android Plugin DSL Reference 参考文档 :
BuildType ( build.gradle#android#buildTypes 配置 ) 文档位置 : android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.BuildType.html
BuildType#consumerProguardFiles 配置是 Library 中的混淆文件配置 ;
发布的AAR中包含的ProGuard规则文件。
然后,使用AAR的任何应用程序项目都将使用这些proguard规则文件(如果启用了proguard)。
这允许AAR指定收缩或模糊排除规则。
这仅对库项目有效。这在应用程序项目中被忽略。
BuildType#consumerProguardFiles 配置原型 :
List<File> consumerProguardFiles
ProGuard rule files to be included in the published AAR.
These proguard rule files will then be used by any application project that consumes the AAR (if ProGuard is enabled).
This allows AAR to specify shrinking or obfuscation exclude rules.
This is only valid for Library project. This is ignored in Application project.
BuildType ( build.gradle#android#buildTypes 配置 ) 文档位置 : android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.BuildType.html
BuildType#debuggable 配置 是 BuildType 中特有的配置 , 该值默认为 true ;
BuildType#debuggable 配置设置为 true , 则默认生成的是可调式的 apk 安装文件 ;
BuildType#debuggable 配置设置为 false, 则生成的 apk 文件安装运行后 , 无法对 debug 版本的代码进行调试 ;
boolean debuggable
Whether this build type should generate a debuggable apk.
使用示例 :
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "kim.hsl.svg"
minSdkVersion 18
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
applicationIdSuffix ".tom"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix ".jerry"
// 默认为 true , 生成的 debug apk 可调试
// 设置为 false , 生成的 debug apk 不可调试
debuggable false
}
}
}
BuildType ( build.gradle#android#buildTypes 配置 ) 文档位置 : android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.BuildType.html
BuildType#embedMicroApp 配置是 可穿戴设备应用使用的配置 , 普通的手机应用不用处理该配置 ;
是否应使用此构建类型将链接的Android Wear应用嵌入变体中。
Wear应用程序可以与以下代码链接:
dependencies {
freeWearApp project(:wear:free') // applies to variant using the free flavor
wearApp project(':wear:base') // applies to all other variants
}
BuildType#embedMicroApp 配置原型 :
boolean embedMicroApp
Whether a linked Android Wear app should be embedded in variant using this build type.
Wear apps can be linked with the following code:
dependencies {
freeWearApp project(:wear:free') // applies to variant using the free flavor
wearApp project(':wear:base') // applies to all other variants
}