[Android] Using `await MobileAds.instance.initialize()` the app fails to load
See original GitHub issuePlugin Version
google_mobile_ads: ^0.13.6
Steps to Reproduce
Create an app with async main
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await MobileAds.instance.initialize(); //get stuck on this line
..... it does not reach this line
}
Expected results: Do not get stuck the app. Yesterday my apps was working fine on the store. Today all apps do not open because of this problem. I did not make changes on my apps. Happens without any reason since yesterday. Solution was remove “await” word but I have to wait until my users update the apps.
Actual results: They get stuck on that line
Logs
[ ] executing: /Users/leonardo/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.novenayvillancicos.santorosariocatolico
[ +56 ms] executing: /Users/leonardo/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm list packages com.novenayvillancicos.santorosariocatolico
[ +58 ms] package:com.novenayvillancicos.santorosariocatolico
[ +1 ms] executing: /Users/leonardo/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell cat /data/local/tmp/sky.com.novenayvillancicos.santorosariocatolico.sha1
[ +42 ms] ce716c55c6c4bcb0ffc9f7ccce084b4aeff393b7
[ ] Installing APK.
[ +1 ms] Installing build/app/outputs/flutter-apk/app.apk...
[ ] executing: /Users/leonardo/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -t -r /Users/leonardo/Development/flutter/git/santorosario_flutter/build/app/outputs/flutter-apk/app.apk
[+1250 ms] Performing Streamed Install
Success
[ +1 ms] Installing build/app/outputs/flutter-apk/app.apk... (completed in 1,250ms)
[ +1 ms] executing: /Users/leonardo/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell echo -n 6a4bf369167aa3e6ab1860e2a748efe7eeae6eb4 > /data/local/tmp/sky.com.novenayvillancicos.santorosariocatolico.sha1
[ +33 ms] executing: /Users/leonardo/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[ +318 ms] --------- beginning of system
11-10 13:25:45.883 D/CompatibilityChangeReporter( 508): Compat change id reported: 143937733; UID 10102; state: ENABLED
[ +9 ms] executing: /Users/leonardo/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez
enable-checked-mode true --ez verify-entry-points true com.novenayvillancicos.santorosariocatolico/com.novenayvillancicos.santorosariocatolico.MainActivity
[ +301 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.novenayvillancicos.santorosariocatolico/.MainActivity (has extras) }
[ ] Waiting for observatory port to be available...
[+3144 ms] Observatory URL on device: http://127.0.0.1:33313/DN2bSKCOYxE=/
[ ] executing: /Users/leonardo/Library/Android/sdk/platform-tools/adb -s emulator-5554 forward tcp:0 tcp:33313
[ +15 ms] 51881
[ ] Forwarded host port 51881 to device port 33313 for Observatory
[ +4 ms] Caching compiled dill
[ +47 ms] Connecting to service protocol: http://127.0.0.1:51881/DN2bSKCOYxE=/
[ +9 ms] W/FlutterActivityAndFragmentDelegate(19079): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
[ +364 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:51881/DN2bSKCOYxE=/.
[ +211 ms] DDS is listening at http://127.0.0.1:51886/nJNYcB3Dt-8=/.
[ +52 ms] Successfully connected to service protocol: http://127.0.0.1:51881/DN2bSKCOYxE=/
[ +180 ms] DevFS: Creating new filesystem on the device (null)
[ +45 ms] DevFS: Created new filesystem on the device (file:///data/user/0/com.novenayvillancicos.santorosariocatolico/code_cache/santorosario_flutterCYKVCP/santorosario_flutter/)
[ +1 ms] Updating assets
[ +197 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[ +7 ms] Syncing files to device sdk gphone x86...
[ +1 ms] <- reset
[ ] Compiling dart to kernel with 0 updated files
[ +5 ms] <- recompile package:santorosariocatolico/main.dart 838c752f-e9c7-4db8-94e4-a9af77ccb0a5
[ ] <- 838c752f-e9c7-4db8-94e4-a9af77ccb0a5
[ +204 ms] Updating files.
[ ] DevFS: Sync finished
[ ] Syncing files to device sdk gphone x86... (completed in 213ms)
[ ] Synced 0.0MB.
[ +2 ms] <- accept
[ +6 ms] Connected to _flutterView/0xf6a42c20.
[ +3 ms] Flutter run key commands.
[ +2 ms] r Hot reload. 🔥🔥🔥
[ ] R Hot restart.
[ ] h List all available interactive commands.
[ ] d Detach (terminate "flutter run" but leave application running).
[ ] c Clear the screen
[ ] q Quit (terminate the application on the device).
[ ] 💪 Running with sound null safety 💪
[ +1 ms] An Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:51886/nJNYcB3Dt-8=/
[ +77 ms] DevTools activation throttled until 2021-11-10 19:43:08.550687.
[ +255 ms] I/rosariocatolic(19079): Background concurrent copying GC freed 119636(6210KB) AllocSpace objects, 40(1612KB) LOS objects, 49% free, 5501KB/10MB, paused 1.393ms total 164.964ms
[ +38 ms] I/rosariocatolic(19079): The ClassLoaderContext is a special shared library.
[ +110 ms] I/chatty (19079): uid=10154(com.novenayvillancicos.santorosariocatolico) identical 1 line
[ ] I/rosariocatolic(19079): The ClassLoaderContext is a special shared library.
[ ] I/DynamiteModule(19079): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:213806100
[ ] I/DynamiteModule(19079): Selected remote version of com.google.android.gms.ads.dynamite, version >= 213806100
[ +2 ms] D/DynamitePackage(19079): Instantiated singleton DynamitePackage.
[ +1 ms] D/DynamitePackage(19079): Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl
[ +92 ms] W/ConnectionStatusConfig(19079): Dynamic lookup for intent failed for action: com.google.android.gms.leibniz.events.service.START
[ ] W/GmsClient(19079): unable to connect to service: com.google.android.gms.leibniz.events.service.START on com.google.android.gms
[ +60 ms] I/WebViewFactory(19079): Loading com.google.android.webview version 83.0.4103.106 (code 410410681)
[ +2 ms] The Flutter DevTools debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:51886/nJNYcB3Dt-8=/
[ +1 ms] I/rosariocatolic(19079): The ClassLoaderContext is a special shared library.
[ ] D/nativeloader(19079): classloader namespace configured for unbundled product apk.
library_path=/product/app/WebViewGoogle/lib/x86:/product/app/WebViewGoogle/WebViewGoogle.apk!/lib/x86:/product/app/TrichromeLibrary/TrichromeLibrary.apk!/lib/x86:/product/lib:/system/product/lib
[ +23 ms] I/rosariocatolic(19079): The ClassLoaderContext is a special shared library.
[ ] D/nativeloader(19079): classloader namespace configured for unbundled product apk.
library_path=/product/app/WebViewGoogle/lib/x86:/product/app/WebViewGoogle/WebViewGoogle.apk!/lib/x86:/product/app/TrichromeLibrary/TrichromeLibrary.apk!/lib/x86:/product/lib:/system/product/lib
[ +73 ms] I/cr_LibraryLoader(19079): Loaded native library version number "83.0.4103.106"
[ ] I/cr_CachingUmaRecorder(19079): Flushed 3 samples from 3 histograms.
[ +266 ms] W/rosariocatolic(19079): Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (greylist, reflection, allowed)
[ +9 ms] W/cr_media(19079): Requires BLUETOOTH permission
[ +5 ms] D/HostConnection(19079): HostConnection::get() New Host Connection established 0xf6a26730, tid 19424
[ +46 ms] D/HostConnection(19079): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1
ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3
GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
[ +4 ms] D/EGL_emulation(19079): eglCreateContext: 0xf6a16510: maj 3 min 0 rcv 3
[ +3 ms] D/EGL_emulation(19079): eglMakeCurrent: 0xf6a16510: ver 3 0 (tinfo 0xc1aa9f70) (first time)
[ +3 ms] I/rosariocatolic(19079): Waiting for a blocking GC ProfileSaver
[ +200 ms] I/VideoCapabilities(19079): Unsupported profile 4 for video/mp4v-es
[ ] W/cr_MediaCodecUtil(19079): HW encoder for video/avc is not available on this device.
[ +19 ms] D/EGL_emulation(19079): eglCreateContext: 0xf6a283a0: maj 3 min 0 rcv 3
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-x64, locale es-419)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc4)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.62.1)
[✓] Connected device (4 available)
• No issues found!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:17
- Comments:34 (1 by maintainers)
Top Results From Across the Web
MobileAds.initialize(context, id); takes too long - Google Groups
Initialize() method is not mandatory so you should be able to load Ads ... I am having the same issue with my app,...
Read more >How to fix the issue "Ad.load to be called before AdWidget is ...
You can use the AdWidget only after BannerAd is loaded not aftar BannerAd is not null. So, try using a flag for loaded...
Read more >Mediation | Flutter - Google Developers
The quick start guide shows you how to initialize the Mobile Ads SDK. ... wait for initialization to complete before you load ads...
Read more >[Solved]-How to integrate google mobile ads in flutter app-Flutter
Before loading ads, have your app initialize the Mobile Ads SDK by calling MobileAds.instance.initialize() which initializes the SDK and returns a Future ...
Read more >easy_ads_flutter | Flutter Package - Pub.dev
Before loading ads, have your app initialize the Mobile Ads SDK by calling EasyAds.instance.initialize() which initializes the SDK and returns a Future that ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’re having the same issue. It seems that underlying
MobileAds#initialize
invocation never returns async result.The issue happens on Android devices and emulators, builds for iOS do not have this problem.
same issue