Skip to content

Commit

Permalink
解决AGP4.2.0以下报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
qq549631030 committed Sep 24, 2022
1 parent 41f188e commit b68f69a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ buildscript {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:3.0.1"
// classpath project(":library")
classpath "com.github.qq549631030:android-junk-code:1.1.4"
if (PLUGIN_ENABLE.toBoolean()) {
classpath "com.github.qq549631030:android-junk-code:1.1.5"
}
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
2 changes: 1 addition & 1 deletion library/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#project
GROUP=com.github.qq549631030
VERSION_NAME=1.1.4
VERSION_NAME=1.1.5

POM_ARTIFACT_ID=android-junk-code
POM_NAME=AndroidJunkCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AndroidJunkCodePlugin implements Plugin<Project> {
def junkCodeConfig = generateJunkCodeExt.variantConfig.findByName(variantName)
if (junkCodeConfig) {
def junkCodeNamespace = ""
if (android.hasProperty("namespace")) {//AGP 7.3+
if (android.hasProperty("namespace") && android.namespace) {//AGP 4.2.0+
junkCodeNamespace = android.namespace
} else {
//从AndroidManifest.xml找到package name
Expand All @@ -38,7 +38,7 @@ class AndroidJunkCodePlugin implements Plugin<Project> {
}
def junkCodeOutDir = new File(project.buildDir, "generated/source/junk/$variantName")
def generateJunkCodeTaskName = "generate${variantName.capitalize()}JunkCode"
def generateJunkCodeTask = project.tasks.create(generateJunkCodeTaskName, AndroidJunkCodeTask){
def generateJunkCodeTask = project.tasks.create(generateJunkCodeTaskName, AndroidJunkCodeTask) {
config = junkCodeConfig
namespace = junkCodeNamespace
outDir = junkCodeOutDir
Expand Down

0 comments on commit b68f69a

Please sign in to comment.