From 66006853bd7c9d7b33eb6918085f4b300c78df8d Mon Sep 17 00:00:00 2001 From: klaus Date: Thu, 17 Aug 2023 13:53:48 +0900 Subject: [PATCH] =?UTF-8?q?AGP=207.3.1=20=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 6 +-- app/proguard-rules.pro | 117 ++++++++++++++++++++++++++++++++--------- build.gradle | 4 +- 3 files changed, 97 insertions(+), 30 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f402583..5b9ffa2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -104,7 +104,7 @@ dependencies { } // Gson - implementation "com.google.code.gson:gson:2.9.1" + implementation "com.google.code.gson:gson:2.10.1" // Network implementation "com.squareup.retrofit2:retrofit:2.9.0" @@ -113,8 +113,8 @@ dependencies { implementation "com.squareup.okhttp3:logging-interceptor:4.9.3" // RxJava3 - implementation "io.reactivex.rxjava3:rxjava:3.1.3" - implementation "io.reactivex.rxjava3:rxandroid:3.0.0" + implementation "io.reactivex.rxjava3:rxjava:3.1.6" + implementation "io.reactivex.rxjava3:rxandroid:3.0.2" implementation "com.jakewharton.rxbinding4:rxbinding:4.0.0" // permission diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 2a32946..4478a11 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -21,38 +21,76 @@ #-renamesourcefileattribute SourceFile -##---------------Begin: proguard configuration for Gson ---------- -# 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. +### 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 -# For using GSON @Expose annotation --keepattributes *Annotation* +# Keep Gson annotations +# Note: Cannot perform finer selection here to only cover Gson annotations, see also https://stackoverflow.com/q/47515093 +-keepattributes RuntimeVisibleAnnotations,AnnotationDefault -# Gson specific classes --dontwarn sun.misc.** -#-keep class com.google.gson.stream.** { *; } -# Application classes that will be serialized/deserialized over Gson --keep class com.google.gson.examples.android.model.** { ; } +### 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 -# 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 +# Keep class TypeToken (respectively its generic signature) +-keep class com.google.gson.reflect.TypeToken { *; } -# Prevent R8 from leaving Data object members always null +# 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 @SerializedName annotation, but allow obfuscation of their names -keepclassmembers,allowobfuscation class * { - @com.google.gson.annotations.SerializedName ; + @com.google.gson.annotations.SerializedName ; } -# 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 +# 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 ; + @com.google.gson.annotations.JsonAdapter ; + @com.google.gson.annotations.Since ; + @com.google.gson.annotations.Until ; +} -##---------------End: proguard configuration for Gson ---------- +# 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 { + (); +} +-keepclassmembers class * implements com.google.gson.TypeAdapterFactory { + (); +} +-keepclassmembers class * implements com.google.gson.JsonSerializer { + (); +} +-keepclassmembers class * implements com.google.gson.JsonDeserializer { + (); +} + +# 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 ; +} -keep public class * implements com.bumptech.glide.module.GlideModule -keep class * extends com.bumptech.glide.module.AppGlideModule { @@ -112,25 +150,52 @@ @retrofit2.http.* ; } +# Ignore annotation used for build tooling. +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement + # 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.* ; } -keep,allowobfuscation interface <1> -# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). --keep,allowobfuscation,allowshrinking interface retrofit2.Call --keep,allowobfuscation,allowshrinking class retrofit2.Response +# 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 +-keepattributes Signature +-keep 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 + + # Keep generic signature of RxJava3 (R8 full mode strips signatures from non-kept items). + -keep,allowobfuscation,allowshrinking class io.reactivex.rxjava3.core.Flowable + -keep,allowobfuscation,allowshrinking class io.reactivex.rxjava3.core.Maybe + -keep,allowobfuscation,allowshrinking class io.reactivex.rxjava3.core.Observable + -keep,allowobfuscation,allowshrinking class io.reactivex.rxjava3.core.Single + + -if interface * { @retrofit2.http.* public *** *(...); } + -keep,allowoptimization,allowshrinking,allowobfuscation class <3> + -keep,allowoptimization,allowshrinking,allowobfuscation enum <3> + -keep,allowoptimization,allowshrinking,allowobfuscation interface <3> -dontwarn java.nio.file.Files -dontwarn java.nio.file.Path @@ -154,3 +219,5 @@ -keep class androidx.recyclerview.widget.**{*;} -keep class androidx.viewpager2.widget.**{*;} + +-keep class kr.co.bootpay.core.** { *; } diff --git a/build.gradle b/build.gradle index ca81687..5d7c247 100644 --- a/build.gradle +++ b/build.gradle @@ -17,8 +17,8 @@ buildscript { } plugins { - id 'com.android.application' version '8.0.2' apply false - id 'com.android.library' version '8.0.2' apply false + id 'com.android.application' version '7.3.1' apply false + id 'com.android.library' version '7.3.1' apply false id 'org.jetbrains.kotlin.android' version '1.8.20' apply false id "org.jlleitschuh.gradle.ktlint" version "11.2.0"