Unity 2019.4 AdMob crashes the app on Android

933 views
Skip to first unread message

Krasimir Chonov

unread,
Jul 14, 2020, 4:18:10 AM7/14/20
to Google Mobile Ads SDK Developers
Engine: Unity 2019.4.1f
Google Mobile Ads Unity plugin, version 5.2.0
LG G4 and Huawei P Smart
Test app id: ca-app-pub-3940256099942544/5224354917

Reproduction steps:

1. Clone project from https://github.com/googleads/googleads-mobile-unity
2. Open HelloWorld sample project in Unity
3. Import AdMob for Unity 5.2.0
4. Open Assets > Google Mobile Ads > Settings
5. Enable AdМob
6. Enter ca-app-pub-3940256099942544/5224354917 for Android
7. Open File > Build Settings
8. Add current scene
9. Click Build and generate helloworld.apk
10. Upload it to phone (Huawei P Smart or LG G4)
11. Install it
12. Start the app
13. It crashes immediatelly

See attached logcat for details. The file is from Huawei P Smart

After unpacking the generated apk file I investigated the content of AndroidManifest.xml with HEX editor. The correct APP ID is present in the file.

The exact error is:

07-14 10:49:34.647 32050 32050 E AndroidRuntime: FATAL EXCEPTION: main
07-14 10:49:34.647 32050 32050 E AndroidRuntime: Process: com.DefaultCompany.HelloWorld, PID: 32050
07-14 10:49:34.647 32050 32050 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
07-14 10:49:34.647 32050 32050 E AndroidRuntime:
07-14 10:49:34.647 32050 32050 E AndroidRuntime: ******************************************************************************
07-14 10:49:34.647 32050 32050 E AndroidRuntime: * Invalid application ID. Follow instructions here:                          *
07-14 10:49:34.647 32050 32050 E AndroidRuntime: * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
07-14 10:49:34.647 32050 32050 E AndroidRuntime: * to find your app ID.                                                       *
07-14 10:49:34.647 32050 32050 E AndroidRuntime: ******************************************************************************
07-14 10:49:34.647 32050 32050 E AndroidRuntime:
07-14 10:49:34.647 32050 32050 E AndroidRuntime:
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.app.ActivityThread.installProvider(ActivityThread.java:7215)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.app.ActivityThread.installContentProviders(ActivityThread.java:6699)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6600)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.app.ActivityThread.-wrap2(Unknown Source:0)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:108)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.os.Looper.loop(Looper.java:166)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:7529)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
07-14 10:49:34.647 32050 32050 E AndroidRuntime: Caused by: java.lang.IllegalStateException:
07-14 10:49:34.647 32050 32050 E AndroidRuntime:
07-14 10:49:34.647 32050 32050 E AndroidRuntime: ******************************************************************************
07-14 10:49:34.647 32050 32050 E AndroidRuntime: * Invalid application ID. Follow instructions here:                          *
07-14 10:49:34.647 32050 32050 E AndroidRuntime: * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
07-14 10:49:34.647 32050 32050 E AndroidRuntime: * to find your app ID.                                                       *
07-14 10:49:34.647 32050 32050 E AndroidRuntime: ******************************************************************************
07-14 10:49:34.647 32050 32050 E AndroidRuntime:
07-14 10:49:34.647 32050 32050 E AndroidRuntime:
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at com.google.android.gms.internal.ads.zzyz.attachInfo(com.google.android.gms:play-services-ads-lite@@19.2.0:24)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.2.0:3)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     at android.app.ActivityThread.installProvider(ActivityThread.java:7212)
07-14 10:49:34.647 32050 32050 E AndroidRuntime:     ... 10 more



Kind Regards,
Krasimir Chonov
output.txt

Mobile Ads SDK Forum Advisor Prod

unread,
Jul 14, 2020, 4:48:10 AM7/14/20
to kch...@gmail.com, google-adm...@googlegroups.com

Hi Krasimir,

 

Thank you for reaching out to us.

 

It seems that you've incorrectly entered an ad unit ID instead of an app ID in the AdMob settings of your Unity project. Kindly note that app IDs have a tilde (~) in the middle; ad unit IDs, on the other hand, have a forward slash (/) instead. With this in mind, you may try using the sample app ID from the first link above to see if it would fix the issue.

 

Regards,

Ziv Yves Sanchez

Mobile Ads SDK Team



ref:_00D1U1174p._5004Q21lXpy:ref

Krasimir Chonov

unread,
Jul 14, 2020, 5:28:19 AM7/14/20
to Google Mobile Ads SDK Developers
Hey Ziv Yves Sanchez.

Thank you man! This was such a facepalm!

Now it works as a charm :)

Kind Regards,
Krasimir Chonov
Message has been deleted

Mobile Ads SDK Forum Advisor

unread,
Feb 10, 2022, 10:33:33 AM2/10/22
to contact.st...@gmail.com, google-adm...@googlegroups.com

Hi Shota,

Thank you for reaching out to us.

As the error mentioned, this is the error when you mistakenly used an invalid app id. An example of an app id is like "ca-app-pub-3940256099942544~3347511713" while the ad unit id is ca-app-pub-3940256099942544/6300978111. You can follow this guide on how you can set up your AdMob App ID. Also, you can check this article on where you can find your app Id in your account.

On the other hand, I've deleted your post as it contains private information.

Regards,

Google Logo
Princess Pamela
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q21lXpy:ref
Reply all
Reply to author
Forward
0 new messages