Fix: Resolve crash on startup due to ProGuard/Gson TypeToken issue

- Added necessary ProGuard rules to keep HighScore class, generic signatures, and annotations.

- Fixed bug where music started on title screen instead of game start.

- Fixed bug where session stats were blank on game over screen by ensuring stats are displayed correctly after high score entry.

- Fixed bug where game music did not restart after playing again.
This commit is contained in:
cmclark00 2025-04-01 17:34:40 -04:00
parent c1da5ba20f
commit 04b87e8f19
4 changed files with 145 additions and 20 deletions

View file

@ -1,10 +1,41 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# By default, the flags in this file are appended to flags specified
# in /Users/coreyclark/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# 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 *;
#}
# Uncomment this to preserve the line number table for debugging exceptions.
#-keepattributes SourceFile,LineNumberTable
# Keep rule for Gson serialization of HighScore data class
-keep class com.pixelmintdrop.model.HighScore { *; }
-keepclassmembers class com.pixelmintdrop.model.HighScore { *; }
# Keep generic signatures for Gson TypeToken
-keepattributes Signature
# Keep annotations used by Gson (e.g., @SerializedName, @Expose)
-keepattributes *Annotation*
# Keep the anonymous inner class generated for the TypeToken in HighScoreManager
-keep class com.pixelmintdrop.model.HighScoreManager$* { *; }
# Keep Gson TypeToken related classes
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class com.google.gson.reflect.** { *; }
# Keep models intact
-keep class com.pixelmintdrop.model.** { *; }