minifyEnabled true 설정시 로그인 안되는 문제

//카카오 로그인
implementation “com.kakao.sdk:v2-user:2.12.0” // 카카오 로그인
implementation “com.kakao.sdk:v2-link:2.8.3” // 메시지(카카오링크)

targetSdk 32

프로가드 추가
-keep class com.kakao.sdk.**.model.* { ; }
-keep class * extends com.google.gson.TypeAdapter

minifyEnabled true 설정시 아래와 같은 에러 발생

java.lang.IllegalArgumentException: Unable to create call adapter for interface retrofit2.Call
for method AuthApi.issueAccessToken
at retrofit2.Utils.methodError(SourceFile:54)
at retrofit2.HttpServiceMethod.createCallAdapter(SourceFile:116)
at retrofit2.HttpServiceMethod.parseAnnotations(SourceFile:67)
at retrofit2.ServiceMethod.parseAnnotations(SourceFile:39)
at retrofit2.Retrofit.loadServiceMethod(SourceFile:202)
at retrofit2.Retrofit$1.invoke(SourceFile:160)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy3.issueAccessToken(Unknown Source)
at com.kakao.sdk.auth.AuthApi$DefaultImpls.issueAccessToken$default(SourceFile:31)
at com.kakao.sdk.auth.AuthApiManager.issueAccessToken$auth_release(SourceFile:59)
at com.kakao.sdk.auth.AuthApiClient.issueAccessToken(SourceFile:45)
at com.kakao.sdk.user.UserApiClient$loginWithKakaoAccount$1.invoke(SourceFile:165)
at com.kakao.sdk.user.UserApiClient$loginWithKakaoAccount$1.invoke(SourceFile:161)
at com.kakao.sdk.auth.AuthCodeClient$resultReceiver$1.receiveOk(SourceFile:180)
at com.kakao.sdk.common.util.KakaoResultReceiver.onReceiveResult(SourceFile:32)
at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:50)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: java.lang.IllegalArgumentException: Call return type must be parameterized as Call or Call<? extends Foo>
at retrofit2.DefaultCallAdapterFactory.get(SourceFile:42)
at retrofit2.Retrofit.nextCallAdapter(SourceFile:253)
at retrofit2.Retrofit.callAdapter(SourceFile:237)
at retrofit2.HttpServiceMethod.createCallAdapter(SourceFile:114)
at retrofit2.HttpServiceMethod.parseAnnotations(SourceFile:67)
at retrofit2.ServiceMethod.parseAnnotations(SourceFile:39)
at retrofit2.Retrofit.loadServiceMethod(SourceFile:202)
at retrofit2.Retrofit$1.invoke(SourceFile:160)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy3.issueAccessToken(Unknown Source)
at com.kakao.sdk.auth.AuthApi$DefaultImpls.issueAccessToken$default(SourceFile:31)
at com.kakao.sdk.auth.AuthApiManager.issueAccessToken$auth_release(SourceFile:59)
at com.kakao.sdk.auth.AuthApiClient.issueAccessToken(SourceFile:45)
at com.kakao.sdk.user.UserApiClient$loginWithKakaoAccount$1.invoke(SourceFile:165)
at com.kakao.sdk.user.UserApiClient$loginWithKakaoAccount$1.invoke(SourceFile:161)
at com.kakao.sdk.auth.AuthCodeClient$resultReceiver$1.receiveOk(SourceFile:180)
at com.kakao.sdk.common.util.KakaoResultReceiver.onReceiveResult(SourceFile:32)
at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:50)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

릴리즈던 디버그던 모두 발생하나

minifyEnabled false 시 릴리즈/ 디버그 모두 로그인 정상동작

해당 부분 확인 부탁 드립니다.

implementation “com.kakao.sdk:v2-link:2.8.3” // 메시지(카카오링크)

우선, 모듈간 버전을 다르게 사용하면 안되니 아래 라이브러리를 사용해주세요.

  implementation "com.kakao.sdk:v2-share:2.12.0" // 메시지(카카오톡 공유)

모듈, 클라이언트, 모델, 메서드 이름 변경 사항은 아래 내용 참고하셔서 변경해주시면됩니다.

Android | Kakao Developers Android

mplementation “com.kakao.sdk:v2-share:2.12.0” // 메시지(카카오톡 공유)

이것으로 변경 하였으나 문제는 동일하게 발생합니다.

네, 난독화 예외와는 무관하나 구버전은 혼용하여 사용하면 안되어 우선 안내드렸습니다.

Android SDK 담당자에게 문의 해보겠습니다.

안녕하세요

난독화 설정을 해서 테스트해봐도 이슈가 재현되지가 않네요.

카카오SDK 이외에 사용하고 계신 라이브러리들 정보(이름, 버전)와 난독화 설정, 구현하신 코드 첨부 부탁드리겠습니다.

메시지 3개 보내드렸습니다
현재 난독화를 true하면 카카오 네이버 둘다 로그인이 되지 않습니다.
네이버에도 문의를 해 놓은 상태입니다.

minifyEnabled false 로 하면 릴리즈건 디버그건 apk릴리즈로 만들어서 설치후 로그인시 둘다 정상동작 하나
minifyEnabled true일때만 되지 않고 있습니다.

sdk:v2 로 변경하기 전에는 모든것이 정상동작했었습니다
sdk:v2로 변경 후에 문제가 발생하고 있는것 입니다.

앱 설정
compileSdk 32
minSdk 24
targetSdk 32

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

lint {
    abortOnError false
    checkReleaseBuilds false
}

보내주신 것들도 확인해서 비슷하게 구현해봤지만 이슈가 재현되지가 않아서 정확한 원인은 파악하지 못했습니다ㅠㅠ

에러 로그를 확인해봤을 때 난독화되는 과정에서 retrofit 내부 동작에 필요한 클래스까지도 난독화되어서 에러가 발생했을 가능성이 있어보여서 proguard에 retrofit 관련 설정도 추가해서 확인 부탁드리겠습니다.

저의 경우
implementation “com.kakao.sdk:v2-user:2.13.0” // 카카오 로그인
을 사용했고 난독화 설정시 앱이 죽었습다.
바로 위 댓글에서 proguard 설정 중 retrofit 관련 설정

#R8 full mode strips generic signatures from return types if not kept.
-if interface * { @retrofit2.http.* public *** *(…); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>

을 적용하니 해결되었습니다.

3개의 좋아요

implementation “com.kakao.sdk:v2-user:2.11.1” // 카카오 로그인

저도 이걸로 해결했습니다