-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating Gradle, AGP, Kotlin versions
- Loading branch information
1 parent
1129b57
commit dddfbfa
Showing
7 changed files
with
135 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
### Gson ProGuard and R8 rules which are relevant for all users | ||
### This file is automatically recognized by ProGuard and R8, see https://developer.android.com/build/shrink-code#configuration-files | ||
### | ||
### IMPORTANT: | ||
### - These rules are additive; don't include anything here which is not specific to Gson (such as completely | ||
### disabling obfuscation for all classes); the user would be unable to disable that then | ||
### - These rules are not complete; users will most likely have to add additional rules for their specific | ||
### classes, for example to disable obfuscation for certain fields or to keep no-args constructors | ||
### | ||
|
||
# Keep generic signatures; needed for correct type resolution | ||
-keepattributes Signature | ||
|
||
# Keep Gson annotations | ||
# Note: Cannot perform finer selection here to only cover Gson annotations, see also https://stackoverflow.com/q/47515093 | ||
-keepattributes RuntimeVisibleAnnotations,AnnotationDefault | ||
|
||
### The following rules are needed for R8 in "full mode" which only adheres to `-keepattribtues` if | ||
### the corresponding class or field is matches by a `-keep` rule as well, see | ||
### https://r8.googlesource.com/r8/+/refs/heads/main/compatibility-faq.md#r8-full-mode | ||
|
||
# Keep class TypeToken (respectively its generic signature) if present | ||
-if class com.google.gson.reflect.TypeToken | ||
-keep,allowobfuscation class com.google.gson.reflect.TypeToken | ||
|
||
# Keep any (anonymous) classes extending TypeToken | ||
-keep,allowobfuscation class * extends com.google.gson.reflect.TypeToken | ||
|
||
# Keep classes with @JsonAdapter annotation | ||
-keep,allowobfuscation,allowoptimization @com.google.gson.annotations.JsonAdapter class * | ||
|
||
# Keep fields with any other Gson annotation | ||
# Also allow obfuscation, assuming that users will additionally use @SerializedName or | ||
# other means to preserve the field names | ||
-keepclassmembers,allowobfuscation class * { | ||
@com.google.gson.annotations.Expose <fields>; | ||
@com.google.gson.annotations.JsonAdapter <fields>; | ||
@com.google.gson.annotations.Since <fields>; | ||
@com.google.gson.annotations.Until <fields>; | ||
} | ||
|
||
# Keep no-args constructor of classes which can be used with @JsonAdapter | ||
# By default their no-args constructor is invoked to create an adapter instance | ||
-keepclassmembers class * extends com.google.gson.TypeAdapter { | ||
<init>(); | ||
} | ||
-keepclassmembers class * implements com.google.gson.TypeAdapterFactory { | ||
<init>(); | ||
} | ||
-keepclassmembers class * implements com.google.gson.JsonSerializer { | ||
<init>(); | ||
} | ||
-keepclassmembers class * implements com.google.gson.JsonDeserializer { | ||
<init>(); | ||
} | ||
|
||
# Keep fields annotated with @SerializedName for classes which are referenced. | ||
# If classes with fields annotated with @SerializedName have a no-args | ||
# constructor keep that as well. Based on | ||
# https://issuetracker.google.com/issues/150189783#comment11. | ||
# See also https://github.com/google/gson/pull/2420#discussion_r1241813541 | ||
# for a more detailed explanation. | ||
-if class * | ||
-keepclasseswithmembers,allowobfuscation class <1> { | ||
@com.google.gson.annotations.SerializedName <fields>; | ||
} | ||
-if class * { | ||
@com.google.gson.annotations.SerializedName <fields>; | ||
} | ||
-keepclassmembers,allowobfuscation,allowoptimization class <1> { | ||
<init>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and | ||
# EnclosingMethod is required to use InnerClasses. | ||
-keepattributes Signature, InnerClasses, EnclosingMethod | ||
|
||
# Retrofit does reflection on method and parameter annotations. | ||
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations | ||
|
||
# Keep annotation default values (e.g., retrofit2.http.Field.encoded). | ||
-keepattributes AnnotationDefault | ||
|
||
# Retain service method parameters when optimizing. | ||
-keepclassmembers,allowshrinking,allowobfuscation interface * { | ||
@retrofit2.http.* <methods>; | ||
} | ||
|
||
# Ignore JSR 305 annotations for embedding nullability information. | ||
-dontwarn javax.annotation.** | ||
|
||
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. | ||
-dontwarn kotlin.Unit | ||
|
||
# Top-level functions that can only be used by Kotlin. | ||
-dontwarn retrofit2.KotlinExtensions | ||
-dontwarn retrofit2.KotlinExtensions$* | ||
|
||
# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy | ||
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this. | ||
-if interface * { @retrofit2.http.* <methods>; } | ||
-keep,allowobfuscation interface <1> | ||
|
||
# Keep inherited services. | ||
-if interface * { @retrofit2.http.* <methods>; } | ||
-keep,allowobfuscation interface * extends <1> | ||
|
||
# With R8 full mode generic signatures are stripped for classes that are not | ||
# kept. Suspend functions are wrapped in continuations where the type argument | ||
# is used. | ||
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation | ||
|
||
# R8 full mode strips generic signatures from return types if not kept. | ||
-if interface * { @retrofit2.http.* public *** *(...); } | ||
-keep,allowoptimization,allowshrinking,allowobfuscation class <3> | ||
|
||
# With R8 full mode generic signatures are stripped for classes that are not kept. | ||
-keep,allowobfuscation,allowshrinking class retrofit2.Response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters