From 2cbc0187642db88ba52507e49fca1ae3b98a0caf Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 13 Oct 2022 16:07:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0gradle=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index b95eba43d..33feb71bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -54,6 +54,21 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + applicationVariants.all { variant -> + 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" + def isGooglePlay=rootProject.ext.manifestPlaceholders.isGooglePlay + if(file(manifestPath).exists()&&isGooglePlay) { + def manifestContent = file(manifestPath).getText() + manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '') + file(manifestPath).write(manifestContent) + }else{ + print "not Exists = "+manifestPath + } + } + } signingConfigs { release { keyAlias 'phonelive' @@ -141,6 +156,7 @@ dependencies { } // 链接包需要注释掉 否正无法更新 谷歌包需要打开 +/* project.afterEvaluate { android.applicationVariants.all { variant -> variant.outputs.each { output -> @@ -152,4 +168,4 @@ project.afterEvaluate { } } } -} \ No newline at end of file +}*/