From ff07d957f5884b6fc690aabfaffa66fcec6c5e1e Mon Sep 17 00:00:00 2001 From: unam98 Date: Sat, 4 Apr 2026 15:51:28 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20R8=20=EB=82=9C=EB=8F=85=ED=99=94=20?= =?UTF-8?q?=EC=8B=9C=20Retrofit=20API=20=ED=98=B8=EC=B6=9C=20=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. kotlin.Result 제네릭 타입 정보 보존 (-keep class kotlin.Result) - R8이 inline class인 kotlin.Result의 Signature를 최적화하면서 Retrofit의 ResultCallAdapterFactory가 Call> 타입을 인식 못함 - https://github.com/square/retrofit/issues/3880 2. BaseResponse/ErrorResponse DTO 필드명 보존 (-keepclassmembers) - ResponseInterceptor에서 Gson으로 역직렬화 시 필드명 매핑 실패 방지 - 범위를 data.dto.response.base 패키지로 한정 --- app/proguard-rules.pro | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 63fa6423..4c0bf0a6 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -11,6 +11,18 @@ -keepattributes SourceFile,LineNumberTable -keep public class * extends java.lang.Exception +# --- Retrofit + kotlin.Result --- +# kotlin.Result는 inline class라 R8이 제네릭 타입 정보를 최적화함 +# Retrofit이 Call>의 타입 파라미터를 리플렉션으로 읽지 못해 CallAdapter 생성 실패 +# https://github.com/square/retrofit/issues/3880 +-keep class kotlin.Result { *; } +-keepattributes Signature + +# --- DTO --- +# Gson 리플렉션으로 역직렬화되는 DTO 클래스의 필드명 보존 +# (BaseResponse, ErrorResponse 등이 ResponseInterceptor에서 Gson으로 파싱됨) +-keepclassmembers class com.runnect.runnect.data.dto.response.base.** { ; } + # --- Kakao SDK --- # 공식 문서: https://developers.kakao.com/docs/latest/en/android/getting-started#configure-for-shrinking-and-obfuscation-(optional) -keep class com.kakao.sdk.**.model.* { ; }