こんなエラーメッセージ。
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ru.balumates.balu, PID: 4409
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:6242)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
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.zzmn.attachInfo(Unknown Source:17)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source:3)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
... 10 more
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
Google Mobile Ads SDK v17.0.0 以降で必須だと。
Google Ads Developer Blog: Announcing v17.0.0 of the Android Google Mobile Ads SDK
このことは、
implementation "com.google.firebase:firebase-ads:17.0.0"
も同じ。
以下、AndroidManifest.xml の必須記述。
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-################~##########"/>
</application>
</manifest>
Ad Manager や NativeAppInstallAd / NativeContentAd も注意が必要な模様。
関連ワード: Android・AndroidStudio・ライブラリ・速報・開発・Admob・java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider