Closed LondonX closed 7 months ago
Hi @LondonX, that stack trace doesn't look like it involves the google_mobile_ads
flutter plugin. Can you provide one that does so we can properly triage? Thanks!
You should see either io.flutter.plugins.googlemobileads
or gms
in the stack trace.
Yes, that is strange, but my the crashed screen of my app has nothing fancy but NativeAd and BannerAd. I open a issue on Flutter https://github.com/flutter/flutter/issues/147204#issue-2257731510 , hope they can find some key info.
Here are some addition infos:
My app as also integrated som mediations
com.google.android.gms:play-services-ads:23.0.0
com.google.android.ads:mediation-test-suite:3.0.0
com.google.ads.mediation:facebook:6.17.0.0
com.google.ads.mediation:unity:4.10.0.0
com.google.ads.mediation:pangle:5.9.0.2.0
com.google.ads.mediation:mintegral:16.7.11.0
com.google.ads.mediation:applovin:12.4.2.0
com.google.ads.mediation:chartboost:9.7.0.0
com.google.ads.mediation:inmobi:10.6.7.1
com.android.internal.policy
shows in logs, maybe the crash is related to user consent form?
androidx.privacysandbox.ads:ads-adservices:1.0.0-beta05
Hey @LondonX, it's possible, but it's also worth noting the privacy sandbox is unrelated to the google_mobile_ads
flutter plugin. I'd try pinpointing which integrations can be added/removed without reproducing to crash to pinpoint the source.
If these crashes are on app start, it might be worth exploring optimizing Mobile Ads SDK initialization. Also possible it has no direct affect, however, based on the stack trace.
Finally, I can reproduce on my Pixel 6.
In my app, the widget ads (native and banner) are contained with a AnimatedContainer
, makes the ads collapsing when keyboard showing and expand the ads when keyboard dismissed.
Here comes with the interesting thing, while widget ads load and showing on screen, user tap the search bar and keyboard showing, tap the search results and a interstitial ad shows, close the interstitial ad and go back to the search result list, then crash.
So I replace the AnimatedContainer
with isKeyboardShowing ? const SizeBox(width: double.maxFinite) : MyAdsView(...)
, the crash gone.
In my conclusion, this crash is not related to mediations nor consent form, I can reproduce with test ad unit ID.
And I think the refresh rate and the FPS may be positively correlated with crash rate, so I cannot reproduce this crash on Pixel 3 but can reproduce on Pixel 6, and crashed devices shows on firebase are high-end even flagship devices.
Hey @LondonX, if you can share the crash log and if the stack trace includes any references to google_mobile_ads
we can start the troubleshooting process.
Strange, I created a new project with minimal code to make a Native ad in AnimatedContainer, also collapsing and expanding with keyboard visibility changing, nothing crash.
Maybe I show close this issue for now. Thank you for your patient reply!
[REQUIRED] Step 1: Describe your environment
Plugin Version
google_mobile_ads: dependency: transitive description: name: google_mobile_ads sha256: f07d4e2ebf56181e8dd18ee810607e84aeac8add5251bb44c1c886af47ff021a url: "https://pub.dev" source: hosted version: "5.0.0"
[REQUIRED] Step 2: Describe the problem
My app embed the native, banner ads with video player, and I catch some randomly crashes. 81% Samsung and 15% Motorola, 68% Android 14, 32% Android 13 devices shows on firebase crashlytics. According to the events, it shows the crashes may not relate to be video player, because some users were never reach the player view before this crash. The logs is attached below.
Steps to Reproduce
Cannot reproduce, it works perfectly on google pixel device.
Expected results:
Actual results:
Logs
``` Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Surface android.media.ImageReader.getSurface()' on a null object reference at io.flutter.plugin.platform.b.getSurface(ImageReaderPlatformViewRenderTarget.java:3) at io.flutter.plugin.platform.b.lockHardwareCanvas(ImageReaderPlatformViewRenderTarget.java:1) at io.flutter.plugin.platform.n.draw(PlatformViewWrapper.java:16) at android.view.View.updateDisplayListIfDirty(View.java:24024) at android.view.View.draw(View.java:24895) at android.view.ViewGroup.drawChild(ViewGroup.java:4789) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4547) at android.view.View.updateDisplayListIfDirty(View.java:24010) at android.view.View.draw(View.java:24895) at android.view.ViewGroup.drawChild(ViewGroup.java:4789) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4547) at android.view.View.updateDisplayListIfDirty(View.java:24010) at android.view.View.draw(View.java:24895) at android.view.ViewGroup.drawChild(ViewGroup.java:4789) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4547) at android.view.View.updateDisplayListIfDirty(View.java:24010) at android.view.View.draw(View.java:24895) at android.view.ViewGroup.drawChild(ViewGroup.java:4789) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4547) at com.android.internal.policy.DecorView.dispatchDraw(DecorView.java:1185) at android.view.View.draw(View.java:25168) at com.android.internal.policy.DecorView.draw(DecorView.java:1167) at android.view.View.updateDisplayListIfDirty(View.java:24024) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:764) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:770) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:868) at android.view.ViewRootImpl.draw(ViewRootImpl.java:5993) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:5662) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4770) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3275) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:11256) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1650) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1659) at android.view.Choreographer.doCallbacks(Choreographer.java:1129) at android.view.Choreographer.doFrame(Choreographer.java:1055) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1622) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8913) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) ``` ``` Analyzing iptv_flt... info • 'WillPopScope' is deprecated and shouldn't be used. Use PopScope instead. This feature was deprecated after v3.12.0-1.0.pre • lib/home/home_container.dart:111:12 • deprecated_member_use info • 'WillPopScope.new' is deprecated and shouldn't be used. Use PopScope instead. This feature was deprecated after v3.12.0-1.0.pre • lib/home/home_container.dart:111:12 • deprecated_member_use info • 'WillPopScope' is deprecated and shouldn't be used. Use PopScope instead. This feature was deprecated after v3.12.0-1.0.pre • lib/util/net/app_updater.dart:112:18 • deprecated_member_use info • 'WillPopScope.new' is deprecated and shouldn't be used. Use PopScope instead. This feature was deprecated after v3.12.0-1.0.pre • lib/util/net/app_updater.dart:112:18 • deprecated_member_use 4 issues found. (ran in 15.4s) ``` ``` [✓] Flutter (Channel stable, 3.19.5, on macOS 14.4 23E214 darwin-x64, locale zh-Hans-CN) • Flutter version 3.19.5 on channel stable at /Users/london/Library/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 300451adae (4 weeks ago), 2024-03-27 21:54:07 -0500 • Engine revision e76c956498 • Dart version 3.3.3 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/london/Library/Android/sdk/ • Platform android-34, build-tools 34.0.0 • ANDROID_SDK_ROOT = /Users/london/Library/Android/sdk/ • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.14.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • 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 17.0.6+0-17.0.6b829.9-10027231) [✓] VS Code (version 1.88.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.86.0 [✓] Proxy Configuration • HTTP_PROXY is set • NO_PROXY is localhost,127.0.0.1,::1 • NO_PROXY contains localhost • NO_PROXY contains 127.0.0.1 • NO_PROXY contains ::1 [✓] Connected device (4 available) • Pixel 6 (mobile) • 26111FDF6002Q4 • android-arm64 • Android 14 (API 34) • London’s iPhone (mobile) • 00008101-001E39DE3A63001E • ios • iOS 17.4.1 21E236 • macOS (desktop) • macos • darwin-x64 • macOS 14.4 23E214 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.61 ! Error: Browsing on the local area network for 邓慧的 iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27) [✓] Network resources • All expected network resources are available. • No issues found! ```