안드로이드 개발

Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException

피커 2021. 9. 10. 12:49
728x90
반응형

안드로이드를 개발하다보면 광고를 넣기위해 admob을 적용합니다.

하지만 이때 아래와 같은 에러를 만날수 있습니다.

위 문제에 대한 해결책을 공유드립니다.

 

해결 방법 : androidManifest.xml 파일에 admob application id를 넣습니다.

앱의 AndroidManifest.xml 파일을 열어봅니다.

android:name="com.google.android.gms.ads.APPLICATION_ID"가 있는 <meta-data> 태그를 추가합니다.

아래처럼 적용하면 됩니다.

<manifest>
    <application>
        <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
    </application>
</manifest>

 

아래는 에러 메시지 원본 내용입니다.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.picker.puzzleapp, PID: 21211
    java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: 
    
    ******************************************************************************
    * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
    * should follow the instructions here:                                       *
    * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
    * to add a valid App ID inside the AndroidManifest.                          *
    * Google Ad Manager publishers should follow instructions here:              *
    * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
    ******************************************************************************
    
    
        at android.app.ActivityThread.installProvider(ActivityThread.java:6988)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)
        at android.app.ActivityThread.access$1300(ActivityThread.java:219)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
     Caused by: java.lang.IllegalStateException: 
    
    ******************************************************************************
    * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
    * should follow the instructions here:                                       *
    * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
    * to add a valid App ID inside the AndroidManifest.                          *
    * Google Ad Manager publishers should follow instructions here:              *
    * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
    ******************************************************************************
    
    
        at com.google.android.gms.internal.ads.zzbhw.attachInfo(com.google.android.gms:play-services-ads-lite@@20.3.0:20)
        at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@20.3.0:1)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
         ... 10 more

 

 

 

 

반응형