在android{}里添加代码,然后clean即可
一、aarproductFlavors {
"com.yxl.paopao" {} //修改为的值
}
android.libraryVariants.all { variant ->
variant.outputs[0].processManifest.doLast {
def manifestFile = "${projectDir}/src/main/AndroidManifest.xml" //AndroidManifest.xml的位置
//lb_target_pkgname 需要替换的值
def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll("lb_target_pkgname", "${variant.productFlavors[0].name}")
new File(manifestFile).write(updatedContent, 'UTF-8')
}
}
二、apkproductFlavors {
"com.yxl.paopao" {} //修改为的值
}
android.applicationVariants.all { variant ->
variant.outputs[0].processManifest.doLast {
def manifestFile = "${projectDir}/src/main/AndroidManifest.xml" //AndroidManifest.xml的位置
//lb_target_pkgname 需要替换的值
def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll("lb_target_pkgname", "${variant.productFlavors[0].name}")
new File(manifestFile).write(updatedContent, 'UTF-8')
}
}