From 5b36e2b392354177ae32af4a6c709387409d54b2 Mon Sep 17 00:00:00 2001 From: iliyangermanov Date: Tue, 22 Aug 2023 19:54:37 +0300 Subject: [PATCH] Fix Retrofit proguard problems --- app/proguard-rules.pro | 25 ++++++++++++++++++- .../com/ivy/wallet/buildsrc/dependencies.kt | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 1c4f00ff50..7e2d6590c0 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -11,4 +11,27 @@ -keepattributes Signature -keep class com.google.gson.reflect.TypeToken { *; } -keep class * extends com.google.gson.reflect.TypeToken --keep class com.google.gson.** { *; } \ No newline at end of file +-keep class com.google.gson.** { *; } + +# Keep inherited services. +-if interface * { @retrofit2.http.* ; } +-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> + +# If a class is used in some way by the application, and has fields annotated with @SerializedName +# and a no-args constructor, keep those fields and the constructor +# 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,allowoptimization class <1> { + (); + @com.google.gson.annotations.SerializedName ; +} \ No newline at end of file diff --git a/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt b/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt index 6df99223b3..ff7b2c570b 100644 --- a/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt +++ b/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt @@ -238,7 +238,7 @@ fun DependencyHandler.Networking( //URL: https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor - implementation("com.squareup.okhttp3:logging-interceptor:4.9.1") + implementation("com.squareup.okhttp3:logging-interceptor:4.11.0") } /**