Adjust proguard for Android R8

1. Use JDK 21
2. Update android plugins for JDK 21
3. Update gradle wrapper

The new R8 engine will change more class names than before, we thus
need to save those needed ones.
This commit is contained in:
JingMatrix 2024-05-14 08:20:38 +02:00
parent f3beb8688f
commit 0a935413fc
11 changed files with 31 additions and 32 deletions

View File

@ -56,7 +56,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: "21"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
.project
.settings
*.iml
.gradle
/local.properties

View File

@ -70,9 +70,9 @@ val androidTargetSdkVersion by extra(34)
val androidMinSdkVersion by extra(27)
val androidBuildToolsVersion by extra("34.0.0")
val androidCompileSdkVersion by extra(34)
val androidCompileNdkVersion by extra("26.1.10909125")
val androidSourceCompatibility by extra(JavaVersion.VERSION_17)
val androidTargetCompatibility by extra(JavaVersion.VERSION_17)
val androidCompileNdkVersion by extra("26.3.11579264")
val androidSourceCompatibility by extra(JavaVersion.VERSION_21)
val androidTargetCompatibility by extra(JavaVersion.VERSION_21)
tasks.register("Delete", Delete::class) {
delete(rootProject.layout.buildDirectory)

View File

@ -1,7 +1,12 @@
-keep class android.** { *; }
-keep class de.robv.android.xposed.** {*;}
-keep class io.github.libxposed.** {*;}
-keep class org.lsposed.lspd.core.* {*;}
-keep class org.lsposed.lspd.impl.LSPosedBridge$NativeHooker {*;}
-keep class org.lsposed.lspd.impl.LSPosedBridge$HookerCallback {*;}
-keep class org.lsposed.lspd.util.Hookers {*;}
-keepattributes RuntimeVisibleAnnotations
-keep class android.** { *; }
-keepclasseswithmembers,includedescriptorclasses class * {
native <methods>;
}
@ -15,15 +20,6 @@
@io.github.libxposed.api.annotations.BeforeInvocation <methods>;
@io.github.libxposed.api.annotations.AfterInvocation <methods>;
}
-keepclassmembers class org.lsposed.lspd.impl.LSPosedBridge$NativeHooker {
<init>(java.lang.reflect.Executable);
callback(...);
}
-keepclassmembers class org.lsposed.lspd.impl.LSPosedBridge$HookerCallback {
final *** beforeInvocation;
final *** afterInvocation;
HookerCallback(...);
}
-assumenosideeffects class android.util.Log {
public static *** v(...);
public static *** d(...);

View File

@ -11,7 +11,5 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.experimental.enableNewResourceShrinker.preciseShrinking=true
android.enableAppCompileTimeRClass=true
android.useAndroidX=true
android.nonFinalResIds=false

View File

@ -1,7 +1,7 @@
[versions]
agp = "8.2.1"
kotlin = "1.9.22"
nav = "2.7.6"
agp = "8.4.0"
kotlin = "1.9.23"
nav = "2.7.7"
appcenter = "5.0.4"
libxposed = "100"
glide = "4.16.0"

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

20
gradlew.bat vendored
View File

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View File

@ -200,7 +200,8 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
rename(".*\\.apk", "daemon.apk")
}
into("lib") {
from(layout.buildDirectory.dir("intermediates/stripped_native_libs/$variantCapped/out/lib")) {
val libDir = variantCapped + "/strip${variantCapped}DebugSymbols"
from(layout.buildDirectory.dir("intermediates/stripped_native_libs/$libDir/out/lib")) {
include("**/liblspd.so")
}
}
@ -303,7 +304,7 @@ val pushDaemonNative = task<Exec>("pushDaemonNative") {
}
outputStream.toString().trim()
}
workingDir(project(":daemon").layout.buildDirectory.dir("intermediates/stripped_native_libs/debug/out/lib/$abi"))
workingDir(project(":daemon").layout.buildDirectory.dir("intermediates/stripped_native_libs/debug/stripDebugDebugSymbols/out/lib/$abi"))
}
commandLine(adb, "push", "libdaemon.so", "/data/local/tmp/libdaemon.so")
}

View File

@ -15,3 +15,5 @@
-repackageclasses
-allowaccessmodification
-dontwarn org.slf4j.impl.StaticLoggerBinder
-dontwarn org.lsposed.lspd.core.*
-dontwarn org.lsposed.lspd.util.Hookers