Build->Select Build Variants->release 然后 Make Projects,即可自动生成签名的apk ,然后Build->Select Build Variants->debug 选择回debug模式
/* 自定义APK安装包名*/
android.applicationVariants.all {
variant ->
variant.outputs.all {
if (!variant.buildType.isDebuggable()) {
// 自定义输出路径
variant.getPackageApplication().outputDirectory = new File(project.rootDir.absolutePath + File.separator + "app" + File.separator + "release")
// 自定义APP名称
outputFileName = "xxx_v" + getVersionName() + ".apk"
}
}
}
signingConfigs {
release {
keyAlias 'key0'
keyPassword 'xxx'
storeFile file('../keys.jks')
storePassword 'xxx'
}
}
网友评论