调整gradle打包脚本

This commit is contained in:
zlzw 2024-05-06 14:42:31 +08:00
parent 0a87f300b4
commit 4695e040a1

View File

@ -116,11 +116,15 @@ android {
String variantName = variant.name.capitalize()
def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
processManifestTask.doLast { pm ->
String manifestPath = "build/intermediates/bundle_manifest/release/bundle-manifest/AndroidManifest.xml"
String manifestPath = "build/intermediates/merged_manifests/release/processReleaseManifest/AndroidManifest.xml"
def isGooglePlay = rootProject.ext.manifestPlaceholders.isGooglePlay
if (file(manifestPath).exists() && isGooglePlay==1) {
println "谷歌版本:" + isGooglePlay
println "文件存在" + file(manifestPath).exists()
println "" + (isGooglePlay ==1)
println "" + (file(manifestPath).exists() && isGooglePlay == 1)
if (file(manifestPath).exists() && isGooglePlay == 1) {
def manifestContent = file(manifestPath).getText()
println "移除权限"
manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />', '')
file(manifestPath).write(manifestContent)
} else {
@ -170,7 +174,7 @@ android {
isGoogle = "谷歌"
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) {
isGoogle = "Huawei"
}else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
isGoogle = "Samsung"
}
def isPlugin = "完整"