crossplatformkorea / react-native-kakao-login

react-native native module for Kakao sign in.
MIT License
364 stars 137 forks source link

안드로이드 release 빌드에서만 runtime에 ClassNotFoundException가 발생합니다 #264

Open sinjohr opened 3 years ago

sinjohr commented 3 years ago

Version of kakao-login libraries

3.3.3

Version of react-native

0.63.4

Platforms you faced the error (IOS or Android or both?)

안드로이드

Expected behavior

카카오톡이 설치되어 있으면 정상 로그인이 되야 합니다.

Actual behavior

카카오 로그인 호출시 안드로이드 로그를 보면 다음과 같은 에러가 찍힙니다.

2021-10-31 22:28:03.969 4255-7156/? E/Parcel: Class not found when unmarshalling: com.kakao.sdk.auth.AuthCodeClient$resultReceiver$1
    java.lang.ClassNotFoundException: com.kakao.sdk.auth.AuthCodeClient$resultReceiver$1
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at android.os.Parcel.readParcelableCreator(Parcel.java:3350)
        at android.os.Parcel.readParcelable(Parcel.java:3284)
        at android.os.Parcel.readValue(Parcel.java:3186)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3579)
        at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292)
        at android.os.BaseBundle.unparcel(BaseBundle.java:236)
        at android.os.BaseBundle.getString(BaseBundle.java:1196)
        at android.content.Intent.getStringExtra(Intent.java:8889)
        at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1128)
        at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:894)
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1721)
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1571)
        at com.android.server.wm.ActivityTaskManagerService.startActivity(ActivityTaskManagerService.java:1523)
        at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:1671)
        at android.os.Binder.execTransactInternal(Binder.java:1190)
        at android.os.Binder.execTransact(Binder.java:1159)
     Caused by: java.lang.ClassNotFoundException: com.kakao.sdk.auth.AuthCodeClient$resultReceiver$1
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:454) 
        at android.os.Parcel.readParcelableCreator(Parcel.java:3350) 
        at android.os.Parcel.readParcelable(Parcel.java:3284) 
        at android.os.Parcel.readValue(Parcel.java:3186) 
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3579) 
        at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292) 
        at android.os.BaseBundle.unparcel(BaseBundle.java:236) 
        at android.os.BaseBundle.getString(BaseBundle.java:1196) 
        at android.content.Intent.getStringExtra(Intent.java:8889) 
        at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1128) 
        at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:894) 
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1721) 
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1571) 
        at com.android.server.wm.ActivityTaskManagerService.startActivity(ActivityTaskManagerService.java:1523) 
        at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:1671) 
        at android.os.Binder.execTransactInternal(Binder.java:1190) 
        at android.os.Binder.execTransact(Binder.java:1159) 

debug 빌드를 실제 기기에 올리면 잘 동작하나, release 빌드시에만 현상이 발생합니다.

proguard가 다음과 같이 설정되어 있습니다.

def enableProguardInReleaseBuilds = true
...
buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
            resValue "string", "CodePushDeploymentKey", '"AbQd0x-CJ4F3uSR85MuZ9NaZvnMja51DZMVoQ"'
        }
-keep class com.kakao.sdk.**.model.* { <fields>; }
-keep class * extends com.google.gson.TypeAdapter
-keep class com.kakao.sdk.**.model.* { <fields>; }
-keep class * extends com.google.gson.TypeAdapter

-keep class com.kakao.** { *; }
-keepattributes Signature
-keepclassmembers class * {
  public static <fields>;
  public *;
}

Tested environment (Emulator? Real Device?)

real device, 갤럭시 A30

sinjohr commented 3 years ago

Update

"E/Parcel: Class not found when unmarshalling: com.kakao.sdk.auth.AuthCodeClient$resultReceiver$1" 라는 메시지로 구글링하면 proguard가 문제라는 글들이 있으나, 이 경우에는 이게 문제가 아니었음.

구글링 한 결과 특정 삼성 device에서만 classloader 문제가 있는데 다음과 같은 링크에서 해결책을 제시하고는 있음

그러나 react native로 작성한 코드여서, 저러한 자바 코드 수정을 어디에서 해야 하는지 모르겠음

RyuWoong commented 3 years ago

지금 삼성 폰에서 카카오톡 로그인시 안되는 이유가 현 이슈 맞을까요?