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.

Crash in Android: onInitializationComplete is called twice in MobileAds#initialize

See original GitHub issue

Bug report

After we switched from firebase_admob to the google_mobile_ads Plugin (Version: 0.11.0+3) we are seeing repeating crashes of some of our Android users.

onInitializationComplete() of MobileAds#initialize in GoogleMobileAdsPlugin.java is called twice, which is not supported by DartMessenger.

Stack trace:

Fatal Exception: java.lang.IllegalStateException: Reply already submitted at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:155) at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:238) at io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin$1.onInitializationComplete(GoogleMobileAdsPlugin.java:211) at com.google.android.gms.internal.ads.zzzn$zza.zze(zzzn.java:6) at com.google.android.gms.internal.ads.zzajn.zza(zzajn.java:11) at com.google.android.gms.internal.ads.zzgy.onTransact(zzgy.java:13) at android.os.Binder.transact(Binder.java:635) at gi.bd(gi.java:2) at com.google.android.gms.ads.internal.initialization.f.e(f.java) at com.google.android.gms.ads.nonagon.initialization.a.run(a.java:2) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at qx.a(qx.java) at com.google.android.gms.ads.internal.util.zzaj.a(zzaj.java:1) at qx.dispatchMessage(qx.java) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:7000) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Steps to reproduce

We could not reproduce the crash by ourselves, yet, but we have several affected Android users.

Expected behavior

No crash, onInitializationComplete called once per app start


Additional context

We use Google-Mobile-Ads as a mediation service and have included additional mediated ad networks:

  • AppLovin
  • Facebook
  • IronSource
  • UnityAds
  • Vungle

For all affected users the first InitializationStatus result of MobileAds.instance.initialize() only contains informations about AdMob, the other expected ad networks are missing:

adapterStatuses: (com.google.android.gms.ads.MobileAds: AdapterStatus(state: AdapterInitializationState.ready, latency: 0.0))


Issue Analytics

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

github_iconTop GitHub Comments

2reactions
kolotumcommented, Jun 1, 2021

Any updates on this? This is pretty critical issue - some user just can’t use app at all.

We have added a workaround in our fork: https://github.com/lotum/googleads-mobile-flutter/commit/868811eab40800b12e1a3da2afe1317ee6ff424f

We abort when onInitializationComplete is called again. So far we are not seeing any issues using this solution and the crash does not occur anymore with the above workaround.

1reaction
greymagcommented, Jun 1, 2021

Any updates on this? This is pretty critical issue - some user just can’t use app at all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crash after calling to MobileAds.initialize - Google Groups
I'm getting crash when the app starts and I call to MobileAds.initialize. Firebase shows that 99% is from Samsung devices and 99% Android...
Read more >
Detect and diagnose crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
App crashes in run-time due to Mobile.MobileAds.initialize(this ...
I am struggling with an issue: My app crashes after initialization of the MobileAds. I have an app with dynamic features (on-demand delivery ......
Read more >
Get Started | Android - Google Developers
A mobile ads SDK for Google AdMob publishers who are building Android apps. ... Google Mobile Ads SDK by calling MobileAds.initialize() which initializes ......
Read more >
Application crashes when navigating twice through the same ...
android.arch.navigation:navigation-fragment-ktx ... P3, Crash caused by navigating twice via the same action in a subgraph ... Code called twice:
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