googleads / googleads-mobile-flutter

A Flutter plugin for the Google Mobile Ads SDK
Apache License 2.0
340 stars 284 forks source link

[Android] Using `await MobileAds.instance.initialize()` the app fails to load #429

Closed fleoparra closed 1 year ago

fleoparra commented 2 years ago

Plugin 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 ```[ +21 ms] Stopping app 'app.apk' on sdk gphone x86. [ ] 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 ``` ```Doctor summary (to see all details, run flutter doctor -v): [βœ“] 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! ```
pmmdz commented 2 years ago

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.

FlutterUIStore commented 2 years ago

Plugin 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

you getting any solution?

azharxes commented 2 years ago

This issue ruined the ratings of my app of million+ downloads, had to remove the "await" as a temporary fix in new update. Ads are not working now.

maheshj01 commented 2 years ago

Hi @fleoparra, Thanks for filing the issue. I could not reproduce the issue using ads plugin 0.13.6 when intilializing ads usingawait the app loads and runs fine. Please take a look at the below code sample let me know if I am missing anything.

code sample ```dart import 'package:flutter/material.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import 'package:triage/banner.dart'; import 'package:flutter/services.dart'; import 'app_open_ad_manager.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); // setting prefered orientations SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); await MobileAds.instance.initialize(); print('app is loading'); runApp(const BannerApp()); } const String testDevice = 'YOUR_DEVICE_ID'; const int maxFailedLoadAttempts = 3; class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { static const AdRequest request = AdRequest( keywords: ['foo', 'bar'], contentUrl: 'http://foo.com/bar.html', nonPersonalizedAds: true, ); InterstitialAd? _interstitialAd; int _numInterstitialLoadAttempts = 0; @override void initState() { super.initState(); _createInterstitialAd(); AppOpenAdManager appOpenAdManager = AppOpenAdManager()..loadAd(); WidgetsBinding.instance! .addObserver(AppLifecycleReactor(appOpenAdManager: appOpenAdManager)); } void _createInterstitialAd() { InterstitialAd.load( adUnitId: InterstitialAd.testAdUnitId, request: request, adLoadCallback: InterstitialAdLoadCallback( onAdLoaded: (InterstitialAd ad) { print('$ad loaded'); _interstitialAd = ad; _numInterstitialLoadAttempts = 0; _interstitialAd!.setImmersiveMode(true); }, onAdFailedToLoad: (LoadAdError error) { print('InterstitialAd failed to load: $error.'); _numInterstitialLoadAttempts += 1; _interstitialAd = null; if (_numInterstitialLoadAttempts <= maxFailedLoadAttempts) { _createInterstitialAd(); } }, )); } void _showInterstitialAd() { if (_interstitialAd == null) { print('Warning: attempt to show interstitial before loaded.'); return; } _interstitialAd!.fullScreenContentCallback = FullScreenContentCallback( onAdShowedFullScreenContent: (InterstitialAd ad) => print('ad onAdShowedFullScreenContent.'), onAdDismissedFullScreenContent: (InterstitialAd ad) { print('$ad onAdDismissedFullScreenContent.'); ad.dispose(); _createInterstitialAd(); }, onAdFailedToShowFullScreenContent: (InterstitialAd ad, AdError error) { print('$ad onAdFailedToShowFullScreenContent: $error'); ad.dispose(); _createInterstitialAd(); }, ); _interstitialAd!.show(); _interstitialAd = null; } @override void dispose() { super.dispose(); _interstitialAd?.dispose(); } @override Widget build(BuildContext context) { return MaterialApp( home: Builder(builder: (BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('AdMob Demo'), ), body: SafeArea( child: Center( child: OutlinedButton( onPressed: () => _showInterstitialAd(), child: const Text('View Interstitial Ads'))), ), ); }), ); } } class AppLifecycleReactor extends WidgetsBindingObserver { final AppOpenAdManager appOpenAdManager; AppLifecycleReactor({required this.appOpenAdManager}); @override Future didChangeAppLifecycleState(AppLifecycleState state) async { // Try to show an app open ad if the app is being resumed and // we're not already showing an app open ad. if (state == AppLifecycleState.resumed) { appOpenAdManager.showAdIfAvailable(); } } } ```
logs ```console Launching lib/main.dart on Redmi K20 Pro in debug mode... Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 βœ“ Built build/app/outputs/flutter-apk/app-debug.apk. W/FlutterActivityAndFragmentDelegate(18051): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps. Connecting to VM Service at ws://127.0.0.1:56413/gQcvDzZf7H4=/ws I/DynamiteModule(18051): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:213806100 I/DynamiteModule(18051): Selected remote version of com.google.android.gms.ads.dynamite, version >= 213806100 D/DynamitePackage(18051): Instantiated singleton DynamitePackage. D/DynamitePackage(18051): Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl I/Ads (18051): Updating ad debug logging enablement. W/ConnectionStatusConfig(18051): Dynamic lookup for intent failed for action: com.google.android.gms.leibniz.events.service.START W/GmsClient(18051): unable to connect to service: com.google.android.gms.leibniz.events.service.START on com.google.android.gms I/WebViewFactory(18051): Loading com.google.android.webview version 95.0.4638.74 (code 463807433) W/evercode.triag(18051): Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (greylist, reflection, allowed) W/evercode.triag(18051): Accessing hidden method Landroid/os/Trace;->traceBegin(JLjava/lang/String;)V (greylist, reflection, allowed) W/evercode.triag(18051): Accessing hidden method Landroid/os/Trace;->traceEnd(J)V (greylist, reflection, allowed) W/evercode.triag(18051): Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (greylist, reflection, allowed) W/evercode.triag(18051): Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (greylist, reflection, allowed) I/cr_WVCFactoryProvider(18051): Loaded version=95.0.4638.74 minSdkVersion=29 isBundle=true multiprocess=true packageId=2 I/cr_LibraryLoader(18051): Successfully loaded native library I/cr_CachingUmaRecorder(18051): Flushed 8 samples from 8 histograms. E/chromium(18051): [ERROR:network_service_instance_impl.cc(179)] Failed to grant sandbox access to network context data for /data/user/0/com.nevercode.triage/app_webview/Default with result 7: No such file or directory (2) D/EgretLoader(18051): EgretLoader(Context context) D/EgretLoader(18051): The context is not activity W/evercode.triag(18051): Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (greylist, reflection, allowed) W/cr_media(18051): Requires BLUETOOTH permission W/Ads (18051): Update ad debug logging enablement as false I/flutter (18051): app is loading D/DynamitePackage(18051): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl I/Ads (18051): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device. I/DynamiteModule(18051): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:213806100 I/DynamiteModule(18051): Selected remote version of com.google.android.gms.ads.dynamite, version >= 213806100 I/DynamiteModule(18051): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:213806100 I/DynamiteModule(18051): Selected remote version of com.google.android.gms.ads.dynamite, version >= 213806100 W/AdWorker(Defaul(18051): type=1400 audit(0.0:74720): avc: denied { read } for name="u:object_r:vendor_displayfeature_prop:s0" dev="tmpfs" ino=17608 scontext=u:r:untrusted_app:s0:c110,c259,c512,c768 tcontext=u:object_r:vendor_displayfeature_prop:s0 tclass=file permissive=0 app=com.nevercode.triage I/AudioManager(18051): In isSpeakerphoneOn(), calling application: com.nevercode.triage E/libc (18051): Access denied finding property "ro.vendor.df.effect.conflict" E/libc (18051): Access denied finding property "ro.vendor.knock.type" I/GASS (18051): GassClearcutLogger Initialized. I/GASS (18051): GassClearcutLogger Initialized. D/DynamitePackage(18051): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl I/Ads (18051): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device. W/evercode.triag(18051): ClassLoaderContext classpath element mismatch. expected=/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk, found=/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk (PCL[];PCL[/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk*1494706308:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes2.dex*2479783204:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes3.dex*3507244060:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes4.dex*732643454:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes5.dex*549694863:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes6.dex*2459272281:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes7.dex*4028623542:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes8.dex*432643299:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes9.dex*3259878405]{PCL[/system/framework/org.apache.http.legacy.jar*1721227950]} | PCL[];PCL[/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk*1494706308:/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk!classes2.dex*2479783204:/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk!classes3.dex*3507244060:/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk!classes4.dex*732643454:/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk!classes5.dex*549694863:/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk!classes6.dex*2459272281:/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk!classes7.dex*1114000223:/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk!classes8.dex*432643299:/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk!classes9.dex*3259878405]{PCL[/system/framework/org.apache.http.legacy.jar*1721227950]}) I/AudioManager(18051): In isSpeakerphoneOn(), calling application: com.nevercode.triage W/evercode.triag(18051): ClassLoaderContext classpath element mismatch. expected=/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk, found=/data/app/~~7GrrwCSs8cBxp3SKncYZkA==/com.nevercode.triage-c1Gf_cU2tr1pNi3v6yJxqQ==/base.apk (PCL[];PCL[/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk*1494706308:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes2.dex*2479783204:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes3.dex*3507244060:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes4.dex*732643454:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes5.dex*549694863:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes6.dex*2459272281:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes7.dex*4028623542:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes8.dex*432643299:/data/app/~~ZbD2hwap7gVDzQZwPAlGIQ==/com.nevercode.triage-s6422kmb_NN3dyiMFODLww==/base.apk!classes9.dex*3259878405]{PCL[/system/framework/org.apache.http.legacy.jar*1721227950]} | PCL[];PCL[]{PCL[]}) W/AdWorker(Defaul(18051): type=1400 audit(0.0:74721): avc: granted { execute } for path="/data/data/com.nevercode.triage/app_pccache/5/6AAEADF4D41AC6338D5E38F8FB4D05EFD5306A6C/pcam.jar" dev="sda31" ino=4463134 scontext=u:r:untrusted_app:s0:c110,c259,c512,c768 tcontext=u:object_r:app_data_file:s0:c110,c259,c512,c768 tclass=file app=com.nevercode.triage W/Ads (18051): Not retrying to fetch app settings W/Ads (18051): Not retrying to fetch app settings I/evercode.triag(18051): ProcessProfilingInfo new_methods=1431 is saved saved_to_disk=1 resolve_classes_delay=8000 D/EgretLoader(18051): EgretLoader(Context context) D/EgretLoader(18051): The context is not activity D/EgretLoader(18051): EgretLoader(Context context) D/EgretLoader(18051): The context is not activity D/EgretLoader(18051): EgretLoader(Context context) D/EgretLoader(18051): The context is not activity I/DynamiteModule(18051): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:213806100 I/DynamiteModule(18051): Selected remote version of com.google.android.gms.ads.dynamite, version >= 213806100 W/ContentCatcher(18051): Failed to notify a WebView I/DynamiteModule(18051): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:213806100 I/DynamiteModule(18051): Selected remote version of com.google.android.gms.ads.dynamite, version >= 213806100 I/flutter (18051): BannerAd loaded. D/DynamitePackage(18051): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl I/Ads (18051): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device. I/AudioManager(18051): In isSpeakerphoneOn(), calling application: com.nevercode.triage W/Ads (18051): Not retrying to fetch app settings I/evercode.triag(18051): NativeAlloc concurrent copying GC freed 76551(5814KB) AllocSpace objects, 39(1620KB) LOS objects, 49% free, 5619KB/10MB, paused 829us total 102.736ms D/EgretLoader(18051): EgretLoader(Context context) D/EgretLoader(18051): The context is not activity I/DynamiteModule(18051): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:213806100 I/DynamiteModule(18051): Selected remote version of com.google.android.gms.ads.dynamite, version >= 213806100 ```
flutter doctor -v ``` [βœ“] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale en-GB) β€’ Flutter version 2.5.3 at /Users/mahesh/Documents/flutter β€’ Upstream repository https://github.com/flutter/flutter.git β€’ Framework revision 18116933e7 (4 weeks ago), 2021-10-15 10:46:35 -0700 β€’ Engine revision d3ea636dc5 β€’ Dart version 2.14.4 [βœ“] Android toolchain - develop for Android devices (Android SDK version 31.0.0) β€’ Android SDK at /Users/mahesh/Library/Android/sdk β€’ Platform android-31, build-tools 31.0.0 β€’ ANDROID_HOME = /Users/mahesh/Library/Android/sdk β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java β€’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) β€’ All Android licenses accepted. [βœ“] Xcode - develop for iOS and macOS β€’ Xcode at /Applications/Xcode.app/Contents/Developer β€’ Xcode 13.1, Build version 13A1030d β€’ CocoaPods version 1.10.2 [βœ“] Chrome - develop for the web β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [βœ“] Android Studio (version 4.2) β€’ Android Studio at /Applications/Android Studio.app/Contents β€’ Flutter plugin can be installed from: πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter β€’ Dart plugin can be installed from: πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart β€’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) [βœ“] IntelliJ IDEA Community Edition (version 2021.2.1) β€’ IntelliJ at /Applications/IntelliJ IDEA CE.app β€’ Flutter plugin version 60.1.4 β€’ Dart plugin version 212.5080.8 [βœ“] VS Code (version 1.61.2) β€’ VS Code at /Applications/Visual Studio Code.app/Contents β€’ Flutter extension version 3.28.0 [βœ“] Connected device (2 available) β€’ macOS (desktop) β€’ macos β€’ darwin-arm64 β€’ macOS 12.0.1 21A559 darwin-arm β€’ Chrome (web) β€’ chrome β€’ web-javascript β€’ Google Chrome 95.0.4638.69 β€’ No issues found! ```

Thanks

lucassampaio-pixelwolf commented 2 years ago

Also happening with me. In my tests I found this:

  1. It works the first time the app opens, but then never again. For it to work again, you have to uninstall and download the app again.
  2. It's only on Android, and appears to be a problem with the native com.google.android.gms.ads.MobileAds.
  3. It was working until yesterday morning (10/11/2021). Then the app, the same app (not a new build), started getting stuck on Initialize.
fleoparra commented 2 years ago

As other people said, this problem happens only on android devices. In some cases, first time works but other runs fails. I had an app on the store for months with that line working without problems but yesterday we realize that all of our apps with that line get stuck on splash screen.

fleoparra commented 2 years ago

Hi @fleoparra, Thanks for filing the issue. I could not reproduce the issue using ads plugin 0.13.6 when intilializing ads usingawait the app loads and runs fine. Please take a look at the below code sample let me know if I am missing anything. code sample logs flutter doctor -v

Thanks

Hi @maheshmnj, I have replace my main code with your code and happens the same problem on my projects. I had recorded a video for you. https://www.youtube.com/watch?v=G-eCZGUlSlk

prilepskiy commented 2 years ago
  1. It was working until yesterday morning (10/11/2021). Then the app, the same app (not a new build), started getting stuck on Initialize.

I think it started a little earlier, we started receiving users' complaints from the start of November, but we couldn't reproduce that stably before 10.11. After 10.11 our application died for all android users.

prilepskiy commented 2 years ago

Also quote from documentation:

Before loading ads, have your app initialize the Mobile Ads SDK by calling MobileAds.instance.initialize(), which initializes the SDK and returns a Future that finishes once initialization is complete (or after a 30-second timeout).

It's not true, there isn't timeout, the app freezes completely

maheshj01 commented 2 years ago

I tried again with the simplest code sample and yet did not reproduce any issue the ad loads 100% of the time for me. Keeping this issue open for further investigation from the team.

code sample ```dart import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); // setting prefered orientations SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); await MobileAds.instance.initialize(); runApp(const BannerApp()); } class BannerApp extends StatelessWidget { const BannerApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const MaterialApp(home: CenteredBanner()); } } class CenteredBanner extends StatefulWidget { const CenteredBanner({Key? key}) : super(key: key); @override _CenteredBannerState createState() => _CenteredBannerState(); } class _CenteredBannerState extends State { late BannerAd _bannerAd; bool isAdloaded = false; @override void initState() { super.initState(); _bannerAd = BannerAd( adUnitId: BannerAd.testAdUnitId, size: AdSize.mediumRectangle, request: AdRequest(), listener: BannerAdListener( onAdLoaded: (Ad ad) { print('$BannerAd loaded.'); setState(() { isAdloaded = true; }); }, ), ); _bannerAd.load(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Banner Ad'), ), body: SizedBox( height: 50, child: AdWidget( ad: BannerAd( adUnitId: BannerAd.testAdUnitId, request: AdRequest(), size: AdSize.banner, listener: BannerAdListener(), )..load(), ), )); } } ```
flutter doctor -v ``` [βœ“] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale en-GB) β€’ Flutter version 2.5.3 at /Users/mahesh/Documents/flutter β€’ Upstream repository https://github.com/flutter/flutter.git β€’ Framework revision 18116933e7 (4 weeks ago), 2021-10-15 10:46:35 -0700 β€’ Engine revision d3ea636dc5 β€’ Dart version 2.14.4 [βœ“] Android toolchain - develop for Android devices (Android SDK version 31.0.0) β€’ Android SDK at /Users/mahesh/Library/Android/sdk β€’ Platform android-31, build-tools 31.0.0 β€’ ANDROID_HOME = /Users/mahesh/Library/Android/sdk β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java β€’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) β€’ All Android licenses accepted. [βœ“] Xcode - develop for iOS and macOS β€’ Xcode at /Applications/Xcode.app/Contents/Developer β€’ Xcode 13.1, Build version 13A1030d β€’ CocoaPods version 1.10.2 [βœ“] Chrome - develop for the web β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [βœ“] Android Studio (version 4.2) β€’ Android Studio at /Applications/Android Studio.app/Contents β€’ Flutter plugin can be installed from: πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter β€’ Dart plugin can be installed from: πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart β€’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) [βœ“] IntelliJ IDEA Community Edition (version 2021.2.1) β€’ IntelliJ at /Applications/IntelliJ IDEA CE.app β€’ Flutter plugin version 60.1.4 β€’ Dart plugin version 212.5080.8 [βœ“] VS Code (version 1.61.2) β€’ VS Code at /Applications/Visual Studio Code.app/Contents β€’ Flutter extension version 3.28.0 [βœ“] Connected device (2 available) β€’ macOS (desktop) β€’ macos β€’ darwin-arm64 β€’ macOS 12.0.1 21A559 darwin-arm β€’ Chrome (web) β€’ chrome β€’ web-javascript β€’ Google Chrome 95.0.4638.69 β€’ No issues found! ```

cc: @jjliu15

azharxes commented 2 years ago

@maheshmnj did you try it with splash screen?

izzetemredemir commented 2 years ago

The same problem my app crashed all instances. I had to update.

It only initialize with test app id

  <meta-data            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713"/>
2shrestha22 commented 2 years ago

This issue also causing problem to my production app. App was fine until now. Yesterday got a bad review that app is not event opening. After debugging found that MobileAds.instance.initialize() never completes. I didn't change anything (same version of my app was working before) that would affect it. It seems to be issue from Google AdMob.

Workaround is to not await for for MobileAds.instance.initialize().

And a interesting part is that, it does not happen in all device, it don't return any value in Emulator and my mobile POCO F1 (Pixel Experience). But worked fine in POCO X3 (MIUI).

Using google_mobile_ads: ^0.13.3

maheshj01 commented 2 years ago

can anyone please share a minimal project for us to have a look?

Thanks

menzer2015 commented 2 years ago

Hi guys I am also receiving this problem before upgrading to google_mobiles_ads my app in google play was working fine on all devices using the flutter admob, it was even working on my test app, then my android app stop loading, anyone with the old version of my app could load the app and the Ads work fine and anyone who has updated to new version the apps crashes iOS is fine

I get the same issue as everyone, my android app will not load at all unless I change my Application ID to any random ID or I remove Await from MobileAds.instance.initialize() however the ADs will still not load and error message No Ad Config even with test ad ID's,

I can replicate the issue on any app that is using google_mobile_ads just by adding my application ID or any live application ID.

version ^0.13.4 & ^0.13.6 SDK 30 Error message: No Ad config

I think this issue has popped up around the same time for everyone, I had this for a few days not but just saw this tread

Any help would be great thanks

menzer2015 commented 2 years ago

I tried again with the simplest code sample and yet did not reproduce any issue the ad loads 100% of the time for me. Keeping this issue open for further investigation from the team.

code sample flutter doctor -v cc: @jjliu15

Please try with real application ID's and banners

alejandroqs commented 2 years ago

Error persist on google_mobile_ads: ^1.0.0

atrope commented 2 years ago

@alejandroqs can you try to remove that call? If you dont call it the plugin will call on the first request and it may fix your issue,

angelbuzon commented 2 years ago

why the official google_mobile_ads plugin is so bad???

alejandroqs commented 2 years ago

@atrope I don't know if it's related, but following your advice I have another problem: Ads are sometimes displayed, but when the interstitial is closed on release version, the app sometimes crashes (or closes). I have no record of the chash in crashlytics. I'll keep investigating it.

r0hit-gupta commented 2 years ago

This issue has rendered my production app useless for thousands of users. It was all working fine for months 😒

DholaSain commented 2 years ago

This issue ruined the ratings of my app of million+ downloads, had to remove the "await" as a temporary fix in new update. Ads are not working now.

Same πŸ₯Ί

jjliu15 commented 2 years ago

So far I have been unable to reproduce this issue locally. Does anyone have a sample app they could share that reproduces the issue?

azharxes commented 2 years ago

So far I have been unable to reproduce this issue locally. Does anyone have a sample app they could share that reproduces the issue?

@jjliu15 did you add splash screen?

jjliu15 commented 2 years ago

We have confirmed that this is related to a serving change and only affects a subset of app ids. A fix is being worked on which will roll out without needing to update the plugin or SDK version.

For the future, I would not recommend blocking your app's startup on MobileAds.instance.initialize().

minhx3 commented 2 years ago

We have confirmed that this is related to a serving change and only affects a subset of app ids. A fix is being worked on which will roll out without needing to update the plugin or SDK version.

For the future, I would not recommend blocking your app's startup on MobileAds.instance.initialize().

Screen Shot 2021-12-02 at 07 31 07
minhx3 commented 2 years ago

E/AndroidRuntime(17716): FATAL EXCEPTION: main E/AndroidRuntime(17716): java.lang.LinkageError: Method java.lang.Object com.google.android.gms.internal.ads.jo3.zzb() overrides final method in class Lcom/google/android/gms/internal/ads/bo3; (declaration of 'com.google.android.gms.internal.ads.jo3' appears in base.apk) E/AndroidRuntime(17716): at com.google.android.gms.internal.ads.ev0.(Unknown Source:307) E/AndroidRuntime(17716): at com.google.android.gms.internal.ads.dv0.zza(Unknown Source:66) E/AndroidRuntime(17716): at com.google.android.gms.internal.ads.kk2.a(Unknown Source:297) E/AndroidRuntime(17716): at com.google.android.gms.internal.ads.e82.l0(Unknown Source:75) E/AndroidRuntime(17716): at com.google.android.gms.internal.ads.e82.Q2(Unknown Source:5) E/AndroidRuntime(17716): at com.google.android.gms.internal.ads.a70.i(Unknown Source:28) E/AndroidRuntime(17716): at com.google.android.gms.ads.c0.a.b(Unknown Source:29) E/AndroidRuntime(17716): at io.flutter.plugins.googlemobileads.FlutterAdLoader.loadInterstitial(Unknown Source:2) E/AndroidRuntime(17716): at io.flutter.plugins.googlemobileads.FlutterInterstitialAd.load(Unknown Source:23) E/AndroidRuntime(17716): at io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin.onMethodCall(Unknown Source:1365) E/AndroidRuntime(17716): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17) E/AndroidRuntime(17716): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(Unknown Source:49) E/AndroidRuntime(17716): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(Unknown Source:4) E/AndroidRuntime(17716): at android.os.MessageQueue.nativePollOnce(Native Method) E/AndroidRuntime(17716): at android.os.MessageQueue.next(MessageQueue.java:335) E/AndroidRuntime(17716): at android.os.Looper.loop(Looper.java:190) E/AndroidRuntime(17716): at android.app.ActivityThread.main(ActivityThread.java:8052) E/AndroidRuntime(17716): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(17716): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) E/AndroidRuntime(17716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

hukusuke1007 commented 2 years ago

same issue

Fatal Exception: java.lang.LinkageError: Method java.lang.Object com.google.android.gms.internal.ads.jo3.zzb() overrides final method in class Lcom/google/android/gms/internal/ads/bo3; (declaration of 'com.google.android.gms.internal.ads.jo3' appears in base.apk)
       at com.google.android.gms.internal.ads.zzcpq.zza(zzcpq.java:44)
       at com.google.android.gms.internal.ads.zzevk.zza(zzevk.java:365)
       at com.google.android.gms.internal.ads.zzeke.zzN(zzeke.java:58)
       at com.google.android.gms.internal.ads.zzeke.zze(zzeke.java:6)
       at com.google.android.gms.internal.ads.zzbhd.zzg(zzbhd.java:203)
       at com.google.android.gms.ads.BaseAdView.loadAd(BaseAdView.java:6)
       at io.flutter.plugins.googlemobileads.FlutterBannerAd.load(FlutterBannerAd.java:60)
       at io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin.onMethodCall(GoogleMobileAdsPlugin.java:737)
       at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:17)
       at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:49)
       at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:4)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:326)
       at android.os.Looper.loop(Looper.java:160)
       at android.app.ActivityThread.main(ActivityThread.java:6894)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883)
jjliu15 commented 2 years ago

@fleoparra could you confirm if the issue is still happening?

minhx3 commented 2 years ago

still happening with version 1.0.1

ViniOkamoto commented 2 years ago

any news about this handling? The ads are not crashing, but they take a long time to start only in Android Devices.

raspberry-jenshen commented 2 years ago

I've also faced that issue.

After hours of researching, I found that I had 2 places for an app that performs init MobileAds.initialize.

1) Inside the android application class 2) Inside the flutter module (I've integrated flutter as a module)

Just removed one of the initialization and it works.

But still why not show a developer that something went wrong with the library setup? Not a best practice to create such behaviour.

jjliu15 commented 2 years ago

Inside the flutter module (I've integrated flutter as a module) @JenshenSoft where in the flutter module are you referring to?

thekavak commented 1 year ago

Were you able to find any solution? @prilepskiy @ViniOkamoto @minhx3 I'm having a separate problem, I tried 'await' and it still didn't work. This is how it logs. I would be very grateful if you could help.

I/DynamiteModule( 1946): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:223712200 I/DynamiteModule( 1946): Selected remote version of com.google.android.gms.ads.dynamite, version >= 223712200 D/DynamitePackage( 1946): Instantiated singleton DynamitePackage. D/DynamitePackage( 1946): Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl W/ConnectionStatusConfig( 1946): Dynamic lookup for intent failed for action: com.google.android.gms.leibniz.events.service.START W/GmsClient( 1946): unable to connect to service: com.google.android.gms.leibniz.events.service.START on com.google.android.gms W/n.sinifdefteri( 1946): Entry not found I/WebViewFactory( 1946): Loading com.google.android.webview version 107.0.5304.105 (code 530410534) W/n.sinifdefteri( 1946): Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (unsupported, reflection, allowed) W/n.sinifdefteri( 1946): Accessing hidden method Landroid/os/Trace;->traceBegin(JLjava/lang/String;)V (unsupported, reflection, allowed) W/n.sinifdefteri( 1946): Accessing hidden method Landroid/os/Trace;->traceEnd(J)V (unsupported, reflection, allowed) W/n.sinifdefteri( 1946): Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (unsupported, reflection, allowed) W/n.sinifdefteri( 1946): Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (unsupported, reflection, allowed) I/cr_WVCFactoryProvider( 1946): Loaded version=107.0.5304.105 minSdkVersion=29 isBundle=true multiprocess=true packageId=2 I/cr_LibraryLoader( 1946): Successfully loaded native library I/cr_CachingUmaRecorder( 1946): Flushed 9 samples from 9 histograms. D/CompatibilityChangeReporter( 1946): Compat change id reported: 171228096; UID 10178; state: ENABLED W/n.sinifdefteri( 1946): Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (unsupported, reflection, allowed) D/HostConnection( 1946): createUnique: call D/HostConnection( 1946): HostConnection::get() New Host Connection established 0xb400007b031f2e10, tid 2067 W/cr_media( 1946): BLUETOOTH_CONNECT permission is missing. W/cr_media( 1946): registerBluetoothIntentsIfNeeded: Requires BLUETOOTH permission D/HostConnection( 1946): 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_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands 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_gles_max_version_3_0 D/EGL_emulation( 1946): eglCreateContext: 0xb400007b031f1910: maj 3 min 0 rcv 3 D/EGL_emulation( 1946): eglMakeCurrent: 0xb400007b031f1910: ver 3 0 (tinfo 0x7d235ae280) (first time) D/EGL_emulation( 1946): eglCreateContext: 0xb400007b031f1910: maj 3 min 0 rcv 3 D/EGL_emulation( 1946): eglCreateContext: 0xb400007b031f31d0: maj 3 min 0 rcv 3

There is no problem in Flutter doctor.

Here my main code, I tried any of order, but none of them change anything

Screenshot 2022-11-20 at 22 25 22

Francesco-FL commented 1 year ago

My experience with "await MobileAds.instance.initialize()" was a warning on the Google Play Store pre-launch report, which told me that the application was taking too long to launch.

Running tests locally (Motorola g22 Android 12, Flutter), I verified that if I removed the word "await", the application opened much faster (2-3 seconds faster).

zoeyfan commented 1 year ago

Hi there, upon further investigation, we can confirm the ads serving issue mentioned in this thread is now resolved. Meanwhile, we want to call out that Awaiting init in main function is an antipattern. Init involves a network call, which is async and may fail. We recommend you avoid using this approach in the code. Thank you.