From 5e759d4f1f8070c7ca885b98189d0f0b8c49a79b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 12 Jan 2019 16:12:52 -0500 Subject: [PATCH] v0.7.1c: switched to experimental R8 optimizer which replaces proguard. A few things to note: - R8 is currently experimental, but is becoming default in AS 3.4 - R8 results in a decent decrease in bytecode size - R8 necessitates switching off proguard-optimize, as that config nukes the line number table even with -keepattributes LineNumberTable. Hopefully that will be fixed and optimize can be re-enabled for even more size savings. - No instability has been observed, but if any crops up I will revert --- core/build.gradle | 2 +- core/proguard-rules.pro | 8 +------- gradle.properties | 3 +++ 3 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 gradle.properties diff --git a/core/build.gradle b/core/build.gradle index 84362f142..a0f680d97 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -18,7 +18,7 @@ android { release { shrinkResources true minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro index 807fedc79..5ad72d735 100644 --- a/core/proguard-rules.pro +++ b/core/proguard-rules.pro @@ -2,10 +2,4 @@ -keepnames class com.shatteredpixel.** { *; } -keepnames class com.watabou.** { *; } -keep class com.shatteredpixel.shatteredpixeldungeon { *; } --keep class com.watabou.noosa.game { *; } --keepattributes SourceFile,LineNumberTable - -# overrides default in proguard-android-optimize.txt, which is: -# -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* -# This is because code/simplification/arithmetic is safe to use on android 2.0+ --optimizations !code/simplification/cast,!field/*,!class/merging/* \ No newline at end of file +-keep class com.watabou.noosa.game { *; } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..92814f878 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +# enables the new experimental R8 optimizer +# this will be the default starting in android studio 3.4 +android.enableR8 = true \ No newline at end of file