Crash - The Google Mobile Ads SDK was initialized incorrectly.

11,282 views
Skip to first unread message

Pep

unread,
Oct 24, 2018, 8:06:48 PM10/24/18
to Google Mobile Ads SDK Developers
As per the posting guidelines:

integrating with Playservices SDK version play-services:17.0.0
Playservices apk on my device is 14.3.66
Device is Samsung Galaxy S7, o/s version is 8.0.0
compileSdkVersion and targetSdkVersion are 28.0.0 and minSdkVersion is 19

I keep going round in circles trying to get AdMob working when I install my app from PlayStore. The app works fine when I install to my device direct from Android Studio, but keeps crashing when I install the Alpha release from PlayStore.

The crash log is

10-25 00:28:35.292 26017 26017 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
10-25 00:28:35.292 26017 26017 E AndroidRuntime:
10-25 00:28:35.292 26017 26017 E AndroidRuntime: ******************************************************************************
10-25 00:28:35.292 26017 26017 E AndroidRuntime: * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
10-25 00:28:35.292 26017 26017 E AndroidRuntime: * should follow the instructions here: https://goo.gl/fQ2neu to add a valid  *
10-25 00:28:35.292 26017 26017 E AndroidRuntime: * App ID inside the AndroidManifest. Google Ad Manager publishers should     *
10-25 00:28:35.292 26017 26017 E AndroidRuntime: * follow instructions here: https://goo.gl/h17b6x.                           *
10-25 00:28:35.292 26017 26017 E AndroidRuntime: ******************************************************************************
10-25 00:28:35.292 26017 26017 E AndroidRuntime:
10-25 00:28:35.292 26017 26017 E AndroidRuntime:
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at android.app.ActivityThread.-wrap1(Unknown Source:0)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:105)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6944)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
10-25 00:28:35.292 26017 26017 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
10-25 00:28:35.292 26017 26017 E AndroidRuntime: Caused by: java.lang.IllegalStateException:

But as far as I can tell I have initialized AdMob correctly.

In my Manifest.xml I have

    <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="@string/adAppId" />

In my MainActivity I have

MobileAds.initialize(this, getString(R.string.adAppId));

In my fragment I have

AdRequest.Builder builder = new AdRequest.Builder();
builder.addTestDevice("1B13C5A76246A215EFBE3FE70813578E");
adView.loadAd(builder.build());

In my layout I have

<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/adUnitId" />

In my string.xml I have, with my app id and ad unit id that I got from playstore (x'd out here)

<string name="adAppId">ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx</string>
<string name="adUnitId">ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx</string>

I have been trying to get this to work for days and just can't see what I am doing wrong. Any help would be greatly appreciated.

mobileadssdk-a...@google.com

unread,
Oct 25, 2018, 4:02:25 AM10/25/18
to Pep, Google Mobile Ads SDK Developers
Hi,

Thank you for providing to us snippets of your code and other helpful details.

Based from your code snippets, you were able to initialize the Mobile Ads SDK correctly when using the 17.0.0 SDK version. It is indeed odd that the app you uploaded in the PlayStore is getting this crash log, while the same app you are running directly from Android Studio is working fine.

That said, could you provide to us the PlayStore link of the app in question?

Also, there shouldn't be an issue with your account Ids since your app is working when launched from Android Studio, however, for additional information, could you provide to us privately (using Reply privately to author option) the Ad Unit Id and App Id in question?

Regards,
Ivan Bautista
Mobile Ads SDK Team




--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/c02c9146-e3eb-4bee-87aa-2d141cc20f6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mobileadssdk-a...@google.com

unread,
Oct 29, 2018, 4:40:32 AM10/29/18
to Pep, Google Mobile Ads SDK Developers
Hi,

Thank you for confirming that the crash is no longer reproducible in both of your devices.

Given the details so far, I'm not sure why the crash happened previously in your S7 device and now it's not happening anymore. The only possible way that it could happen is if you have incorrectly uploaded previously an older or different apk (that doesn't have the correct SDK initialization implementation) and now, you have uploaded a new apk with the correct implementation. However, you seem to imply that the apk you are testing now is the same one as before wherein it was crashing. If so, then this is really odd because your billing setup should have no relation to the intiialization crash and given that the crash was not reproducible in the same release in your Samsung Tab S device. Setting your devices as test devices should have no relation to the crash as well.

As for having enabled test devices set in your code implementation, please note that you need to remove these code snippets before you release your app. That said, I'm afraid our team (Mobile Ads SDK Team) can only assist you with the code implementation part. However, for any concerns about permissible implementations and activities, please raise them over to the AdMob Help forum as it is the appropriate forum for your concerns. You may also refer to this article and this article when testing the ads in your devices.

Regards,
ivan Bautista
Mobile Ads SDK Team




To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsubscrib...@googlegroups.com.

nasirk...@gmail.com

unread,
Nov 5, 2018, 7:56:48 AM11/5/18
to Google Mobile Ads SDK Developers
11-05 17:31:37.527 32604-32604/com.xspeed.bestphotoeditor E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.xspeed.bestphotoeditor, PID: 32604
    java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: 
    
    ******************************************************************************
    * Invalid application ID. Follow instructions here: https://goo.gl/fQ2neu to *
    * find your app ID.                                                          *
    ******************************************************************************
    
    
        at android.app.ActivityThread.installProvider(ActivityThread.java:5322)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4893)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4833)
        at android.app.ActivityThread.access$1500(ActivityThread.java:178)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531)
        at android.os.Handler.dispatchMessage(Handler.java:111)
        at android.os.Looper.loop(Looper.java:194)
        at android.app.ActivityThread.main(ActivityThread.java:5631)
        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:959)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
     Caused by: java.lang.IllegalStateException: 
    
    ******************************************************************************
    * Invalid application ID. Follow instructions here: https://goo.gl/fQ2neu to *
    * find your app ID.                                                          *
    ******************************************************************************
    
    
        at com.google.android.gms.internal.ads.zzmn.attachInfo(Unknown Source)
        at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source)
        at android.app.ActivityThread.installProvider(ActivityThread.java:5319)
        	... 11 more

nasirk...@gmail.com

unread,
Nov 5, 2018, 7:58:10 AM11/5/18
to Google Mobile Ads SDK Developers
i have the same problem please help me...

mobileadssdk-a...@google.com

unread,
Nov 5, 2018, 3:16:59 PM11/5/18
to nasirk...@gmail.com, Google Mobile Ads SDK Developers
Hi there,

Can you add the complete details about the issue you are facing? Are you able to reproduce the issue with our sample apps? It would be really helpful, if you could elaborate the issue and send us the details.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.

To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

Siddharth Trivedi

unread,
Feb 4, 2019, 10:05:41 AM2/4/19
to Google Mobile Ads SDK Developers

please add this line to your project AndroidManifest.xml

inside <application>

<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="[appid here]"/>

hamzajja...@gmail.com

unread,
Mar 18, 2019, 12:36:53 AM3/18/19
to Google Mobile Ads SDK Developers
Thanks bro resolved  thanks.

hamzajja...@gmail.com

unread,
Mar 18, 2019, 12:40:00 AM3/18/19
to Google Mobile Ads SDK Developers
Thanks bro resolved  thanks.

On Monday, February 4, 2019 at 8:05:41 PM UTC+5, Siddharth Trivedi wrote:
Reply all
Reply to author
Forward
0 new messages