From 267b1b3cc871e58510c159193ae04e753e5cb3fb Mon Sep 17 00:00:00 2001 From: Ishan09811 <156402647+Ishan09811@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:10:19 +0530 Subject: [PATCH] Add proper proguard rules (#412) * add proper proguard-rules * enable apk optimisations * Android: Remove duplicate proguard rule * derp --------- Co-authored-by: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> --- src/pandroid/app/build.gradle.kts | 4 ++-- src/pandroid/app/proguard-rules.pro | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/pandroid/app/build.gradle.kts b/src/pandroid/app/build.gradle.kts index 201d5db1..b67f9419 100644 --- a/src/pandroid/app/build.gradle.kts +++ b/src/pandroid/app/build.gradle.kts @@ -22,8 +22,8 @@ android { buildTypes { getByName("release") { - isMinifyEnabled = false - isShrinkResources = false + isMinifyEnabled = true + isShrinkResources = true isDebuggable = false signingConfig = signingConfigs.getByName("debug") proguardFiles( diff --git a/src/pandroid/app/proguard-rules.pro b/src/pandroid/app/proguard-rules.pro index 481bb434..31c24c5a 100644 --- a/src/pandroid/app/proguard-rules.pro +++ b/src/pandroid/app/proguard-rules.pro @@ -1,16 +1,19 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# +# Pandroid Proguard Rules # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html -# 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 *; -#} +# Keep all JNI and C++ related classes and methods +-keepclasseswithmembernames class * { + native ; +} + +# Keep all native libraries and their methods +-keep class * { + native ; +} + +# Keep all classes in the specified package and its subpackages +-keep class com.panda3ds.pandroid.** {*;} # Uncomment this to preserve the line number information for # debugging stack traces. @@ -18,4 +21,4 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile