try to fix release build - I over optimized it

This commit is contained in:
izzy2lost
2025-08-14 00:32:33 -04:00
parent 2f17f4e525
commit 6b89772cce
2 changed files with 40 additions and 15 deletions
+4 -5
View File
@@ -73,13 +73,12 @@ android {
jniDebuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// Use less aggressive ProGuard rules for native apps
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// R8 full mode is enabled by default in newer AGP versions
// Optimize native libraries
// Keep some debug info for crash reports
ndk {
debugSymbolLevel 'NONE'
debugSymbolLevel 'SYMBOL_TABLE'
}
// Sign the release build
+36 -10
View File
@@ -1,9 +1,9 @@
# Starship Android ProGuard Rules
# Keep SDL classes
# Keep SDL classes - critical for native integration
-keep class org.libsdl.app.** { *; }
# Keep native methods
# Keep all native methods and JNI callbacks
-keepclasseswithmembernames class * {
native <methods>;
}
@@ -28,24 +28,50 @@
# Keep DocumentFile for SAF
-keep class androidx.documentfile.provider.DocumentFile { *; }
# Optimization settings
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizationpasses 5
# Keep all classes that might be accessed via JNI
-keep class * {
public static <methods>;
public static <fields>;
}
# Keep enums - often used by native code
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Keep Serializable classes
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# Less aggressive optimization for native apps
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*,!code/removal/advanced,!code/removal/simple
-optimizationpasses 3
-allowaccessmodification
-dontpreverify
# Remove logging in release builds
# Don't remove logging completely - keep error logs for crash reports
-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(...);
}
# Keep line numbers for crash reports
-keepattributes SourceFile,LineNumberTable
# Keep line numbers and source file for crash reports
-keepattributes SourceFile,LineNumberTable,*Annotation*,Signature
# Rename source file attribute to something shorter
# Rename source file attribute
-renamesourcefileattribute SourceFile
# Don't warn about missing classes that might be platform-specific
-dontwarn javax.**
-dontwarn java.awt.**
-dontwarn org.slf4j.**