본문 바로가기
카카오 REST API & SDK/카카오 로그인

[Legacy Android sdk] AUTHORIZATION_FAILED: Unable to resolve host "kauth.kakao.com": No address associated with hostname

by kakao-TAM 2021. 5. 7.
2021-05-07 11:36:14.087 11204-11204/com.example.myapplication E/KAKAO_SESSION: 로그인 실패
    AUTHORIZATION_FAILED: Unable to resolve host "kauth.kakao.com": No address associated with hostname
        at com.kakao.auth.Session.onAccessTokenFailure(Session.java:765)
        at com.kakao.auth.Session.access$1100(Session.java:56)
        at com.kakao.auth.Session$5.onAccessTokenFailure(Session.java:668)
        at com.kakao.auth.AccessTokenCallback.onFailure(AccessTokenCallback.java:33)
        at com.kakao.network.callback.ResponseCallback.onFailureForUiThread(ResponseCallback.java:62)
        at com.kakao.auth.AccessTokenCallback.onFailureForUiThread(AccessTokenCallback.java:62)
        at com.kakao.network.tasks.KakaoResultTask$1$1.run(KakaoResultTask.java:76)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

SDK 30이상으로 설정한 앱이 android 11에서 실행될 경우
카카오톡 설치여부 검사를 위해 AndroidManifest.xml 에 <queries> 설정이 추가돼 있어야 합니다.

2.0.4 이상 버전에서는 해당 설정이 SDK에 추가되어 있으나 v1을 사용하고 계신다면 직접 설정을 추가하셔야 합니다.

<!-- AndroidManifest.xml -->
<queries>
    <package android:name="com.kakao.talk" />
</queries>

보다 자세한 내용은 구글의 package visibility 가이드를 참고 바랍니다.
medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9

 

Package visibility in Android 11

On Android 10 and earlier, apps could query the full list of installed apps on the system using methods like queryIntentActivities. In most…

medium.com

 

 

AndroidManifest.xml 전체 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication">

    <uses-permission android:name="android.permission.INTERNET" />

    <queries>
        <package android:name="com.kakao.talk" />
    </queries>

    <application
        android:name=".GlobalApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyApplication">

        <meta-data
            android:name="com.kakao.sdk.AppKey"
            android:value="@string/kakao_app_key" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

댓글