Crash in Android: onInitializationComplete is called twice in MobileAds#initialize
See original GitHub issueBug 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
- 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:
- Created 2 years ago
- Reactions:6
- Comments:5 (1 by maintainers)
Top GitHub Comments
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.
Any updates on this? This is pretty critical issue - some user just can’t use app at all.