From 55de53061a6078089ba61ee406b8791f99d5cd92 Mon Sep 17 00:00:00 2001 From: izzy2lost Date: Fri, 12 Sep 2025 08:02:18 -0400 Subject: [PATCH] update for release builds --- app/build.gradle | 27 +++++-------------- app/proguard-rules.pro | 60 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 app/proguard-rules.pro diff --git a/app/build.gradle b/app/build.gradle index dabf4cb..7d2adc6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,7 +12,7 @@ android { minSdk 26 targetSdk 36 versionCode 1 - versionName "1.0" + versionName "1.0.0" // APK setProperty("archivesBaseName","PSX2_${versionCode}_${new Date().format('yyyyMMddHHmm')}") @@ -22,39 +22,26 @@ android { arguments( '-DANDROID=true', '-DCMAKE_BUILD_TYPE=Release', - '-DANDROID_STL=c++_static' + '-DANDROID_STL=c++_static', + '-DPCSX2_PROFILER=OFF' ) - // arguments '-DANDROID=true','-DCMAKE_BUILD_TYPE=Debug','-DANDROID_STL=c++_static' } } ndk { //noinspection ChromeOsAbiSupport abiFilters 'arm64-v8a' } - // Placeholder to toggle profileable per buildType (for AGI) - manifestPlaceholders = [ - profileable: "false" - ] + } buildTypes { release { + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' ndk { - // Keep symbol table for crash triage while testing debugSymbolLevel 'SYMBOL_TABLE' } - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - // Build for profiling with Android GPU Inspector - benchmark { - // Release-like build, not debuggable, but profileable - initWith release - debuggable false - // Use debug keystore to simplify installs - signingConfig signingConfigs.debug - // Turn on profileable in manifest via placeholder - manifestPlaceholders = [ profileable: "true" ] } } // Relax lint for test release builds diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..3215ba2 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,60 @@ +# PSX2 Emulator ProGuard Rules + +# Keep native methods +-keepclasseswithmembernames class * { + native ; +} + +# Keep NativeApp class and all its methods (JNI interface) +-keep class com.izzy2lost.psx2.NativeApp { + public static ; +} + +# Keep MainActivity for proper lifecycle +-keep class com.izzy2lost.psx2.MainActivity { + public ; +} + +# Keep all classes that might be referenced from native code +-keep class com.izzy2lost.psx2.** { *; } + +# Keep Glide for image loading +-keep public class * implements com.bumptech.glide.module.GlideModule +-keep class * extends com.bumptech.glide.module.AppGlideModule { + (...); +} +-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { + **[] $VALUES; + public *; +} +-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder { + *** rewind(); +} + +# Keep Material Design components +-keep class com.google.android.material.** { *; } +-keep interface com.google.android.material.** { *; } + +# Keep AndroidX components +-keep class androidx.** { *; } +-keep interface androidx.** { *; } + +# Remove logging in release builds +-assumenosideeffects class android.util.Log { + public static boolean isLoggable(java.lang.String, int); + public static int v(...); + public static int i(...); + public static int w(...); + public static int d(...); + public static int e(...); +} + +# Optimize and obfuscate +-optimizationpasses 5 +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose + +# Keep line numbers for crash reports +-keepattributes SourceFile,LineNumberTable +-renamesourcefileattribute SourceFile \ No newline at end of file