Skip to content

Commit ff07d95

Browse files
committed
fix: R8 난독화 시 Retrofit API 호출 실패 해결
1. kotlin.Result 제네릭 타입 정보 보존 (-keep class kotlin.Result) - R8이 inline class인 kotlin.Result의 Signature를 최적화하면서 Retrofit의 ResultCallAdapterFactory가 Call<Result<T>> 타입을 인식 못함 - square/retrofit#3880 2. BaseResponse/ErrorResponse DTO 필드명 보존 (-keepclassmembers) - ResponseInterceptor에서 Gson으로 역직렬화 시 필드명 매핑 실패 방지 - 범위를 data.dto.response.base 패키지로 한정
1 parent 7417e63 commit ff07d95

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

app/proguard-rules.pro

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
-keepattributes SourceFile,LineNumberTable
1212
-keep public class * extends java.lang.Exception
1313

14+
# --- Retrofit + kotlin.Result ---
15+
# kotlin.Result는 inline class라 R8이 제네릭 타입 정보를 최적화함
16+
# Retrofit이 Call<Result<T>>의 타입 파라미터를 리플렉션으로 읽지 못해 CallAdapter 생성 실패
17+
# https://github.com/square/retrofit/issues/3880
18+
-keep class kotlin.Result { *; }
19+
-keepattributes Signature
20+
21+
# --- DTO ---
22+
# Gson 리플렉션으로 역직렬화되는 DTO 클래스의 필드명 보존
23+
# (BaseResponse, ErrorResponse 등이 ResponseInterceptor에서 Gson으로 파싱됨)
24+
-keepclassmembers class com.runnect.runnect.data.dto.response.base.** { <fields>; }
25+
1426
# --- Kakao SDK ---
1527
# 공식 문서: https://developers.kakao.com/docs/latest/en/android/getting-started#configure-for-shrinking-and-obfuscation-(optional)
1628
-keep class com.kakao.sdk.**.model.* { <fields>; }

0 commit comments

Comments
 (0)