From 708943b328c59a7f982392ceacbf8c28c2e5bde9 Mon Sep 17 00:00:00 2001 From: huangx <549631030@qq.com> Date: Tue, 27 Jun 2023 00:35:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DAGP=208.1.0+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- library/gradle.properties | 2 +- .../junkcode/plugin/AndroidJunkCodePlugin.groovy | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 0de520d3..add23b8c 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:3.0.1" if (PLUGIN_ENABLE.toBoolean()) { - classpath "com.github.qq549631030:android-junk-code:1.2.4" + classpath "com.github.qq549631030:android-junk-code:1.2.5" } // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/library/gradle.properties b/library/gradle.properties index d6cb7b31..05405b3c 100644 --- a/library/gradle.properties +++ b/library/gradle.properties @@ -1,6 +1,6 @@ #project GROUP=com.github.qq549631030 -VERSION_NAME=1.2.4 +VERSION_NAME=1.2.5 POM_ARTIFACT_ID=android-junk-code POM_NAME=AndroidJunkCode diff --git a/library/src/main/groovy/cn/hx/plugin/junkcode/plugin/AndroidJunkCodePlugin.groovy b/library/src/main/groovy/cn/hx/plugin/junkcode/plugin/AndroidJunkCodePlugin.groovy index 8fa2ac7e..90a8c941 100644 --- a/library/src/main/groovy/cn/hx/plugin/junkcode/plugin/AndroidJunkCodePlugin.groovy +++ b/library/src/main/groovy/cn/hx/plugin/junkcode/plugin/AndroidJunkCodePlugin.groovy @@ -49,9 +49,16 @@ class AndroidJunkCodePlugin implements Plugin { def sourceSet = variant.sourceSets[i] if (!sourceSet.manifestFile.exists()) { sourceSet.manifest.srcFile(manifestFile) - def processManifestTaskProvider = project.tasks.named("process${variantName.capitalize()}Manifest") - if (processManifestTaskProvider) { - processManifestTaskProvider.configure { + //AGP4.1.0+ + def processManifestTaskName = "process${variantName.capitalize()}MainManifest" + def processManifestTask = project.tasks.findByName(processManifestTaskName) + if (processManifestTask == null) { + //before AGP4.1.0 + processManifestTaskName = "process${variantName.capitalize()}Manifest" + processManifestTask = project.tasks.findByName(processManifestTaskName) + } + if (processManifestTask) { + project.tasks.named(processManifestTaskName).configure { it.dependsOn(generateJunkCodeTask) } }