com.kakao.sdk:v2-user-rx:2.0.2를 사용중이고
간혹 커스텀 탭 오픈시 사용자들의 크래시 로그가 발생하는 것 같습니다.
KakaoCustomTabsClient.java line 81
com.kakao.sdk.common.util.KakaoCustomTabsClient.resolveCustomTabsPackage
Fatal Exception: java.lang.RuntimeException: Unable to resume activity {패키지네임/com.kakao.sdk.auth.AuthCodeHandlerActivity}: java.lang.NullPointerException: Attempt to read from field ‘android.content.pm.ActivityInfo android.content.pm.ResolveInfo.activityInfo’ on a null object reference
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4845)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4878)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2276)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8424)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by java.lang.NullPointerException: Attempt to read from field ‘android.content.pm.ActivityInfo android.content.pm.ResolveInfo.activityInfo’ on a null object reference
at com.kakao.sdk.common.util.KakaoCustomTabsClient.resolveCustomTabsPackage(KakaoCustomTabsClient.java:81)
at com.kakao.sdk.common.util.KakaoCustomTabsClient.openWithDefault(KakaoCustomTabsClient.java:36)
at com.kakao.sdk.auth.AuthCodeHandlerActivity.openChromeCustomTab(AuthCodeHandlerActivity.java:83)
at com.kakao.sdk.auth.AuthCodeHandlerActivity.onResume(AuthCodeHandlerActivity.java:61)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1456)
at android.app.Activity.performResume(Activity.java:8317)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4835)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4878)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2276)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8424)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
대략적인 스택이구요
아래는 로그인을 여는 코드 스니펫입니다.
compositeDisposable += Single.just(LoginClient.instance.isKakaoTalkLoginAvailable(context))
.flatMap { available ->
if (available) LoginClient.rx.loginWithKakaoTalk(context)
else LoginClient.rx.loginWithKakaoAccount(context)
}
.observeOn(io.reactivex.android.schedulers.AndroidSchedulers.mainThread())
.onErrorResumeNext {
if (it is AuthError && it.response.error == "NotSupportError") {
LoginClient.rx.loginWithKakaoAccount(context)
} else {
io.reactivex.Single.error(it)
}
}
.subscribe({ oAuthToken ->
val accessToken = oAuthToken.accessToken
listener.onSuccess(accessToken)
}, { error ->
Log.w(error.message!!)
})
context는 액티비티 객체입니다