question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] App crashes at start.

See original GitHub issue

Steps to reproduce:

cordova create test-app com.test.sample
cordova platform add android
cordova run android # It's ok
cordova plugin add cordova-admob-plus --variable ADMOB_APPLICATOIN_ID=<MY_ADMOB_APPID>
cordova run android # crash

adb logcat messages:

adb logcat com.test.sample *:E

10-07 14:18:41.528 27114 27114 E AndroidRuntime: FATAL EXCEPTION: main
10-07 14:18:41.528 27114 27114 E AndroidRuntime: Process: com.test.sample, PID: 27114
10-07 14:18:41.528 27114 27114 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
10-07 14:18:41.528 27114 27114 E AndroidRuntime:
10-07 14:18:41.528 27114 27114 E AndroidRuntime: ******************************************************************************
10-07 14:18:41.528 27114 27114 E AndroidRuntime: * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
10-07 14:18:41.528 27114 27114 E AndroidRuntime: * should follow the instructions here: https://goo.gl/fQ2neu to add a valid  *
10-07 14:18:41.528 27114 27114 E AndroidRuntime: * App ID inside the AndroidManifest. Google Ad Manager publishers should     *
10-07 14:18:41.528 27114 27114 E AndroidRuntime: * follow instructions here: https://goo.gl/h17b6x.                           *
10-07 14:18:41.528 27114 27114 E AndroidRuntime: ******************************************************************************
10-07 14:18:41.528 27114 27114 E AndroidRuntime:
10-07 14:18:41.528 27114 27114 E AndroidRuntime:
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:6501)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:6064)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5968)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at android.app.ActivityThread.-wrap1(Unknown Source:0)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1684)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:105)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:164)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6759)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
10-07 14:18:41.528 27114 27114 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

As described in the instructions link https://goo.gl/fQ2neu, I need to manually add a meta-data to the AndroidManifest.xml file to resolve this error.

wx20181007-143155

Can this be fixed?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
znegvacommented, Oct 11, 2018

A quick workaround for me was to add the following to my config.xml inside of the <platform name="android"> block:

<config-file parent="/manifest/application" target="AndroidManifest.xml">
    <meta-data 
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-3940256099942544~3347511713" />
</config-file>

I also had to add xmlns:android="http://schemas.android.com/apk/res/android" to widget.

I think if these changes (of course with replacing with the correct App-ID) would be added to the plugins plugin.xml everything would be fine.

4reactions
codemasterlikecommented, Oct 24, 2018

Thanks all. Problem solved for my case:

  • I remove all the plugin, and try to run $ cordova build android, with no issue (better list all the plugin and remove one by one to test)
  • I install the android service : $ cordova plugin add cordova-android-play-services-gradle-release
  • I install Admob plus
  • run $ cordova build android again. And it is Ok now.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do my apps keep crashing on Android, How to fix it
How to fix apps that keep crashing on Android · 1. Force stop the app · 2. Restart the device · 4. Reinstall...
Read more >
How to Stop Apps From Crashing on Android - AVG
Press and hold the Power button. · Wait until you see options to Restart or Power off. · Select Restart to start up...
Read more >
Why Do My Apps Keep Crashing on Android? - Avast
1. The “Force stop” method · 2. Restart your Android device · 3. Keep your phone updated · 4. Clear your cached data...
Read more >
How to Fix It When Apps Keep Crashing on Android - Lifewire
How to Fix When Apps Keep Crashing on Android · Reboot your Android. · turn on Wi-Fi on your Android and test the...
Read more >
8 Ways to Fix Android Apps Crashing - MakeUseOf
Tap to open the number of available networks. Choose the one you want to use. Enter the password, and you will start receiving...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found