Skip to content

Commit

Permalink
Enabled shrinking, obfuscation, and optimization for release builds o…
Browse files Browse the repository at this point in the history
…f the module.
  • Loading branch information
DavidBerdik committed Jun 16, 2024
1 parent dc7eb9a commit 5d921fc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
11 changes: 6 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ android {

buildTypes {
release {
isMinifyEnabled = false
isShrinkResources = false
proguardFiles("proguard-rules.pro")
signingConfig = signingConfigs["debug"]
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
}

Expand All @@ -53,7 +54,7 @@ android {

lint {
abortOnError = true
checkReleaseBuilds = false
checkReleaseBuilds = true
}
}

Expand Down
46 changes: 28 additions & 18 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Xposed
-adaptresourcefilecontents META-INF/xposed/java_init.list
-keepattributes RuntimeVisibleAnnotations
-keep,allowobfuscation,allowoptimization public class * extends io.github.libxposed.api.XposedModule {
public <init>(...);
public void onPackageLoaded(...);
public void onSystemServerLoaded(...);
}
-keep,allowoptimization,allowobfuscation @io.github.libxposed.api.annotations.* class * {
@io.github.libxposed.api.annotations.BeforeInvocation <methods>;
@io.github.libxposed.api.annotations.AfterInvocation <methods>;
}

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Kotlin
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static void check*(...);
public static void throw*(...);
}
-assumenosideeffects class java.util.Objects {
public static ** requireNonNull(...);
}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# Strip debug log
-assumenosideeffects class android.util.Log {
public static int v(...);
public static int d(...);
}

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Obfuscation
-repackageclasses
-allowaccessmodification

0 comments on commit 5d921fc

Please sign in to comment.