Skip to content

Commit

Permalink
Merge pull request #465 from auth0/pro-gson
Browse files Browse the repository at this point in the history
Add Java's R8 Proguard rules for Gson
  • Loading branch information
lbalmaceda authored Mar 9, 2021
2 parents 4b11fd6 + 8485a77 commit 3889261
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion proguard/proguard-gson.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@
-keepattributes Signature
-keepattributes *Annotation*

-dontwarn com.google.gson.internal.UnsafeAllocator
-dontwarn com.google.gson.internal.UnsafeAllocator

#R8
# - See https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md
# - See https://medium.com/@harryaung/mysterious-null-crash-with-gson-serializedname-fields-when-r8-proguard-is-on-f8a4bd036e34
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
-keep,allowobfuscation @interface com.google.gson.annotations.SerializedName
3 changes: 2 additions & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ android {
}
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig debug.signingConfig
}
}
testOptions {
Expand Down

0 comments on commit 3889261

Please sign in to comment.