diff --git a/app/build.gradle b/app/build.gradle index 43d7f7a2..2c186ebb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,12 +7,12 @@ apply plugin: 'com.getkeepsafe.dexcount' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 31 + compileSdkVersion 33 defaultConfig { applicationId "cn.hx.plugin.junkcode.demo" minSdkVersion 16 - targetSdkVersion 31 + targetSdkVersion 33 versionCode 1 versionName "1.0" multiDexEnabled true @@ -25,6 +25,7 @@ android { buildTypes { release { minifyEnabled true + shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } diff --git a/build.gradle b/build.gradle index 597a0e95..dfd4cc50 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.0" + classpath "com.github.qq549631030:android-junk-code:1.2.1" } // 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 91d3b346..eccb169e 100644 --- a/library/gradle.properties +++ b/library/gradle.properties @@ -1,6 +1,6 @@ #project GROUP=com.github.qq549631030 -VERSION_NAME=1.2.0 +VERSION_NAME=1.2.1 POM_ARTIFACT_ID=android-junk-code POM_NAME=AndroidJunkCode diff --git a/library/src/main/groovy/cn/hx/plugin/junkcode/task/AndroidJunkCodeTask.groovy b/library/src/main/groovy/cn/hx/plugin/junkcode/task/AndroidJunkCodeTask.groovy index 8e5680d2..7e849c38 100644 --- a/library/src/main/groovy/cn/hx/plugin/junkcode/task/AndroidJunkCodeTask.groovy +++ b/library/src/main/groovy/cn/hx/plugin/junkcode/task/AndroidJunkCodeTask.groovy @@ -181,6 +181,7 @@ class AndroidJunkCodeTask extends DefaultTask { stringList.add("${config.resPrefix.toLowerCase()}${generateName(i)}") } generateStringsFile() + generateKeep() } /** @@ -235,6 +236,14 @@ class AndroidJunkCodeTask extends DefaultTask { writeStringToFile(stringFile, sb.toString()) } + void generateKeep() { + def keepFile = new File(outDir, "res/raw/keep.xml") + StringBuilder sb = new StringBuilder() + sb.append("\n") + writeStringToFile(keepFile, sb.toString()) + } + private void writeJavaFile(JavaFile javaFile) { def outputDirectory = new File(outDir, "java").toPath() if (!javaFile.packageName.isEmpty()) {