android mapping.txt,gradle 保存apk 保存mapping.txt 到其它目录
参考文章android.applicationVariants.all {variant ->//这里是修改输出目录的if(variant.buildType.name=="debug" && !rootProject.ext.devmodelmanager.debug_model_true){variant.getPackageApplication().outputDir
参考文章
android.applicationVariants.all {
variant ->
//这里是修改输出目录的
if(variant.buildType.name=="debug" && !rootProject.ext.devmodelmanager.debug_model_true){
variant.getPackageApplication().outputDirectory = new File(rootProject.ext.android.apkSavePath+"/debug")
}else if(variant.buildType.name!="debug"){
variant.getPackageApplication().outputDirectory = new File(rootProject.ext.android.apkSavePath+"/release")
}
variant.outputs.all {
//这里修改apk文件名
if (isReleaseBuildType()) {
outputFileName = "appName_${rootProject.ext.android.applicationId}_${rootProject.ext.android.versionName}_${releaseTime()}.apk"
} else {
outputFileName = "appName_${rootProject.ext.android.applicationId}_${rootProject.ext.android.versionName}_${releaseTime()}_debug.apk"
}
}
//自动混淆已经开启
if (variant.getBuildType().isMinifyEnabled()) {
def path = "${projectDir}/mappings";
if(variant.buildType.name=="debug"){
path = rootProject.ext.android.apkSavePath+"/debug";
}else{
path = rootProject.ext.android.apkSavePath+"/release";
}
//考本mapping 到目的目录
variant.assemble.doLast {
copy {
from variant.mappingFile
into path
rename { String fileName ->
"mapping_appname_${rootProject.ext.android.applicationId}_${rootProject.ext.android.versionName}.txt"
}
}
}
}
}
更多推荐
所有评论(0)