Proguard관련 질문있습니다

안녕하세요 키워드로 장소검색 api에 관련해서 문의드립니다
private fun searchKeyword(keyword: String) {
val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
val api = retrofit.create(KakaoAPI::class.java)
val call = api.getSearchKeyword(API_KEY, keyword)

    call.enqueue(object: Callback<ResultSearchKeyword> {
        override fun onResponse(call: Call<ResultSearchKeyword>, response: Response<ResultSearchKeyword>) {
            if (response.isSuccessful) {
                val result = response.body()
                if (result != null) {
                    val documents = result.documents
                    if (documents.isNotEmpty()) {
                        Log.e("edit search", response.message().toString())
                        Log.e("edit search", response.code().toString())
                        Log.e("edit search", documents.toString())
                        addItemsAndMarkers(result)
                    } else {
                        Log.e("edit search", "No documents found")
                    }
                } else {
                    Log.e("edit search", "Response body is null")
                }
            } else {
                Log.e("EDIT Search", response.code().toString())
                Log.e("EDIT Search", response.errorBody().toString())
                Log.e("EDIT Search", response.errorBody()?.string() ?: "Unknown error")
                Log.e("EDIT Search", call.request().toString())
                Log.e("EDIT Search", response.message().toString())
            }
        }

        override fun onFailure(call: Call<ResultSearchKeyword>, t: Throwable) {
            Log.w("LocalSearch", "통신 실패: ${t.message}")
        }
    })
}

(https://jangstory.tistory.com/43) 이 분 블로그와 같이 코드를 구현하여 키워드로 장소검색을 해보려했는데
200코드는 받아오는데 document값으로는 아무것도 받아오지 못해 null을 출력합니다
이 현상이 결국 proguard와 연관있음을 확인하고 dev talk, 구글링, github 등 찾아봐서 있을 만한거 다 넣어도
minifyEnabled true일때는 null이고 minifyEnabled false일 때는 잘 받아오더군요… 혹시 proguard를 어떤 식으로 설정해야할까요?

//현재 proguard

Add project specific ProGuard rules here.

You can control the set of applied configuration files using the

proguardFiles setting in build.gradle.

For more details, see

http://developer.android.com/guide/developing/tools/proguard.html

If your project uses WebView with JS, uncomment the following

and specify the fully qualified class name to the JavaScript interface

class:

#-keepclassmembers class fqcn.of.javascript.interface.for.webview {

public *;

#}

Uncomment this to preserve the line number information for

debugging stack traces.

#-keepattributes SourceFile,LineNumberTable

If you keep the line number information, uncomment this to

hide the original source file name.

#-renamesourcefileattribute SourceFile

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

Prevent R8 from leaving Data object members always null

-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName ;
}

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 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>

With R8 full mode generic signatures are stripped for classes that are not kept.

-keep,allowobfuscation,allowshrinking class retrofit2.Response

Retrofit and OkHttp

-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**
-dontwarn kotlin.Unit

Retrofit

-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions

Gson

-keep class com.google.gson.** { ; }
-keep class com.google.gson.stream.
* { *; }
-keepattributes Annotation
-keepattributes Signature
-keepattributes Annotation

Models

-keep class your.package.name.model.** { *; }

Kakao Map SDK

-keep class com.kakao.** { ; }
-keep class net.daum.mf.map.api.
* { ; }
-dontwarn net.daum.mf.map.api.
*
-dontwarn net.daum.android.**
-dontwarn com.kakao.**

-keep class net.daum.android.map.location.MapViewLocationManager { ; }
-keep class net.daum.
* {;}
-keep class android.opengl.** {
;}
-keep class com.kakao.util.maps.helper.** {*;}
-keepattributes Signature
-keepclassmembers class * {
public static ;
public *;
}

Proguard 난독화 문제라면 null 이 아닌 처리중 Exception이 발생하는 것이 일반적이고

response.body() 가 null 이라는 것은
response.code() 200이 아닌 상황으로 response.errorBody()?.string() 를 확인하시면됩니다.

response.code() 가 200일때와 아닐때 분기하여 body 또는 errorBody 확인 하시면됩니다.

2024-05-24 20:08:47.403 21490-21490 Search Error E 200
2024-05-24 20:08:47.403 21490-21490 Search Error E ResultSearchKeyword(meta=null, documents=null)
2024-05-24 20:08:47.403 21490-21490 Search Error E null

Log.e(“Search Error”, response.code().toString())
Log.e(“Search Error”, response.body().toString())
Log.e(“Search Error”, response.errorBody().toString())
로그를 찍어보니 위와 같은 결과가 나오는데 keyword는 잘 들어간 것을 확인했는데

debug와 release의 키 해시 모두 제 앱에 등록했는데 혹시 다른 이유가 있을 수 있을까요?