implementation ‘com.google.firebase:firebase-ads:17.0.0’ 로 버전 업데이트 발생되는 오류
implementation ‘com.google.firebase:firebase-ads:17.0.0’ 로 버전 업데이트 후 발생한 오류인데
오류가 발생하면 앱이 실행되지 않고 죽는다.
10-23 09:54:41.720 4621-4621/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: ddolcatmaster.finedustrecord, PID: 4621
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://goo.gl/fQ2neu to add a valid *
* App ID inside the AndroidManifest. Google Ad Manager publishers should *
* follow instructions here: https://goo.gl/h17b6x. *
******************************************************************************
at android.app.ActivityThread.installProvider(ActivityThread.java:5571)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5163)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5103)
at android.app.ActivityThread.access$1600(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1510)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.IllegalStateException:
******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: https://goo.gl/fQ2neu to add a valid *
* App ID inside the AndroidManifest. Google Ad Manager publishers should *
* follow instructions here: https://goo.gl/h17b6x. *
******************************************************************************
at com.google.android.gms.internal.ads.atr.attachInfo(Unknown Source)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5568)
… 11 more
해결 책 :
dependencies {
implementation 'com.google.android.gms:play-services-ads:17.0.0'
}
build.gradle 파일에 아래 내용 추가한다. ( 없다면....)
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
AndroidManifest.xml 파일에 아래 내용을 추가해줘야 한다.
<manifest>
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
</application>
</manifest>
또는
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
</application>
</manifest>
둘다 되는데, 정확하게 왜 구분해 둔건지 모르겠다.
https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml