调整gradle打包脚本
This commit is contained in:
parent
0a87f300b4
commit
4695e040a1
@ -116,11 +116,15 @@ android {
|
|||||||
String variantName = variant.name.capitalize()
|
String variantName = variant.name.capitalize()
|
||||||
def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
|
def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
|
||||||
processManifestTask.doLast { pm ->
|
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
|
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()
|
def manifestContent = file(manifestPath).getText()
|
||||||
|
println "移除权限"
|
||||||
manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />', '')
|
manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />', '')
|
||||||
file(manifestPath).write(manifestContent)
|
file(manifestPath).write(manifestContent)
|
||||||
} else {
|
} else {
|
||||||
@ -170,7 +174,7 @@ android {
|
|||||||
isGoogle = "谷歌"
|
isGoogle = "谷歌"
|
||||||
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) {
|
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) {
|
||||||
isGoogle = "Huawei"
|
isGoogle = "Huawei"
|
||||||
}else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
|
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
|
||||||
isGoogle = "Samsung"
|
isGoogle = "Samsung"
|
||||||
}
|
}
|
||||||
def isPlugin = "完整"
|
def isPlugin = "完整"
|
||||||
|
Loading…
Reference in New Issue
Block a user