From 4ec7b07040ba03431b2f1222fd9ff3b68dcc818b Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 30 Dec 2024 11:10:02 +0200 Subject: [PATCH] Better proguard rules to enable r8 minification --- android/proguard-rules.pro | 14 ++++++++++++-- .../ui/screens/newgamescreen/IPreviousScreen.kt | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro index 1dfea15e6e..9caacfdba3 100644 --- a/android/proguard-rules.pro +++ b/android/proguard-rules.pro @@ -26,8 +26,18 @@ -dontwarn com.badlogic.gdx.utils.GdxBuild -dontwarn com.badlogic.gdx.jnigen.BuildTarget* --keep class com.badlogic.gdx.controllers.android.AndroidControllers - -keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* { (com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration); } + +# You will need the next three lines if you use scene2d for UI or gameplay. +# If you don't use scene2d at all, you can remove or comment out the next line: +-keep public class com.badlogic.gdx.scenes.scene2d.** { *; } +# You will need the next two lines if you use BitmapFont or any scene2d.ui text: +-keep public class com.badlogic.gdx.graphics.g2d.BitmapFont { *; } +# You will probably need this line in most cases: +-keep public class com.badlogic.gdx.graphics.Color { *; } + +# These two lines are used with mapping files; see https://developer.android.com/build/shrink-code#retracing +-keepattributes LineNumberTable,SourceFile +-renamesourcefileattribute SourceFile diff --git a/core/src/com/unciv/ui/screens/newgamescreen/IPreviousScreen.kt b/core/src/com/unciv/ui/screens/newgamescreen/IPreviousScreen.kt index e066805c3e..42391158bd 100644 --- a/core/src/com/unciv/ui/screens/newgamescreen/IPreviousScreen.kt +++ b/core/src/com/unciv/ui/screens/newgamescreen/IPreviousScreen.kt @@ -10,7 +10,7 @@ import com.unciv.models.ruleset.Ruleset */ interface IPreviousScreen { val gameSetupInfo: GameSetupInfo - var stage: Stage + val stage: Stage val ruleset: Ruleset // Having `fun setRightSideButtonEnabled(boolean: Boolean)` part of this interface gives a warning: