更新时间:2023-01-02 22:35:12
在主模块的 build.gradle
文件中,您可以拥有多种构建类型以及调试类型.
Inside you main module's build.gradle
file you can have multiple build types along with your debug one.
您可以使用
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
zipAlignEnabled true
}
}
注意:旧版本使用zipAlign
,而不是zipAlignEnabled
无论您是否定义,始终为调试和发布构建类型创建默认的 gradle 任务.调试用于调试目的和签名应用程序发布(构建 >> 生成签名 Apk).您必须为发布版本定义签名配置.
Default gradle tasks always created for debug and release buildTypes whether you define or not. Debug is for debugging purpose and Release for Signed Application (Build >> Generate Signed Apk). You must define your signingConfig for release builds.
检查下面提到的链接中的构建类型部分,了解您可以在构建类型中使用的其他属性
Check Build Types section in below mentioned link for other properties that you can use in your buildTypes