Merge branch 'MTRNord/proguard' into 'main'

Update proguard rules to a more modern setup

See merge request famedly/fluffychat!761
This commit is contained in:
Krille Fear 2022-03-03 06:39:06 +00:00
commit 18c3de1de2
3 changed files with 36 additions and 2 deletions

View File

@ -69,8 +69,9 @@ android {
release { release {
signingConfig signingConfigs.release signingConfig signingConfigs.release
minifyEnabled true minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
} }

View File

@ -7,3 +7,35 @@
-keep class io.flutter.** { *; } -keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; } -keep class io.flutter.plugins.** { *; }
-dontwarn io.flutter.embedding.** -dontwarn io.flutter.embedding.**
##---------------Begin: proguard configuration for Gson (Needed for flutter_local_notifications) ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-dontwarn sun.misc.**
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
##---------------End: proguard configuration for Gson (Needed for flutter_local_notifications) ----------

View File

@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M
android.enableR8=true android.enableR8=true
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
android.enableR8.fullMode=true