在android{}里添加代码,然后clean即可
一、aar
productFlavors {
"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')
}
}二、apk
productFlavors {
"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')
}
}
2524

被折叠的 条评论
为什么被折叠?



