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.

NPE Regression with Flutter 2.8+ and BannerAds

See original GitHub issue

Hello, we have a major problem with latest Flutter 2.8+ and BannerAds in Android < 10.

Just like it was reported in #480 but closed, when we have the app run on Androids 7,8,9 and Have Banner ads in line with the

reply by @blasten here: https://github.com/googleads/googleads-mobile-flutter/issues/269#issuecomment-884493288 await PlatformViewsService.synchronizeToNativeViewHierarchy(false); Every action that makes the app go to background (for example clicking the ad, or sharing some content) makes the app crash.

This is in our production app.

Removing the line or Downgrading flutter seems to fix the issue but i consider this a major regression considering it was introduced by Flutter 2.8+ and it is now the recommended way of having inline ads on older devices…

Here is the example app, just run it on Old Android and click the button or the Example banner.

https://github.com/atrope/my_app

Forgot to add the LOG:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.dispatchWindowVisibilityChanged(int)' on a null object reference
       at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1290)
       at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1290)
       at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1290)
       at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1290)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1660)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1348)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6865)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:887)
       at android.view.Choreographer.doCallbacks(Choreographer.java:699)
       at android.view.Choreographer.doFrame(Choreographer.java:634)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:873)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6351)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:786)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

3reactions
maheshmnjcommented, Jan 20, 2022

Hi @atrope, Thanks for filing the issue. This seems to be the same issue as https://github.com/flutter/flutter/issues/96875, Please lets wait for the teams input on the issue filed in flutter/flutter. I will leave this issue open until we have an update on this. This issue triage details can be found here https://github.com/flutter/flutter/issues/96875#issuecomment-1017232275

1reaction
jjliu15commented, Aug 3, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Flutter AdMob banner ads consuming RAM - Stack Overflow
Below, I show the code I'm using to load the banner ads, cache their instances, and add them to the Widget Trees.
Read more >
What's New in Flutter 2.8: Release Notes and Updates - Medium
Hello and welcome to Flutter 2.8! This release contains performance improvements, new Firebase features, desktop status, tooling updates and ...
Read more >
Adding an AdMob banner and native inline ads to a Flutter app
This codelab guides you through implementing an AdMob inline banner and AdMob native inline ads in a Flutter app using the Google Mobile...
Read more >
Anchored adaptive banners | Flutter - Google Developers
This results in banner ads that occupy a more consistent portion of the screen across devices and provides opportunities for improved performance.
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