Skip to main content

AdMob Crash Android

Android Studio: All versions | Appodeal SDK: All versions


If the app crashes on startup, check the logs from your device. Connect a device with the app installed, open the Android Studio Logcat console, run the app and check logs. For more information about the console please visit Debugging with Android Studio.

The following crash happens if AdMob App Id has not been specified in AndroidManifest.xml, which is required for AdMob and A4G networks. Appodeal SDK contains these adapters by default.

The crash log example:

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:7194)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6672)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6567)
at android.app.ActivityThread.access$1400(ActivityThread.java:224)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7562)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: java.lang.IllegalStateException:

...

Use Admob Adapter In Your App

If you are planning to use AdMob and A4G networks add AdMob App Id to meta-data tag in AndroidManifest.xml:

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

AdMob App ID is the unique ID assigned to your app.

To find the AdMob App ID in your AdMob account, go to Apps → your application → app settings and copy the AdMob App ID.

info

For more information about Admob sync check out our guide.

Remove Admob Adapter From Your App

Otherwise, exclude AdMob network from the project.

To do it go to Configure build.gradle section, uncheck Admob network in Mediation Wizard and generate a new build.gradle file.

Additionally you need to manually exclude Notsy and Play Services Ads and use the build.gradle file with the following setup:

implementation("com.appodeal.ads:sdk:3.2.0.+") {
exclude(group = "com.appodeal.ads.sdk.networks", module = "admob")
exclude(group = "io.bidmachine", module = "ads.networks.notsy")
exclude(group = "com.google.android.gms", module = "play-services-ads")
}