Skip to content

[Android] Severe glitch when navigating to a screen with google_mobile_ads #95343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
peterwvj opened this issue Dec 15, 2021 · 68 comments · Fixed by flutter/engine#30724
Closed
Labels
c: performance Relates to speed or footprint issues (see "perf:" labels) c: regression It was better in the past than it is now customer: crowd Affects or could affect many people, though not necessarily a specific customer. engine flutter/engine repository. See also e: labels. f: routes Navigator, Router, and related APIs. found in release: 2.8 Found to occur in 2.8 found in release: 2.9 Found to occur in 2.9 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@peterwvj
Copy link

peterwvj commented Dec 15, 2021

Upgrading to Flutter 2.8.0 causes flickering when navigating between screens in apps that contain ads. In particular, the flickering happens when navigating to a new screen from another screen that has a banner ad. When commenting out the banner the flickering goes away.

The problem is not producible using Flutter 2.5.3.

The issue was originally raised in googleads-mobile-flutter but after investigating the issue further it is now believed to be a problem with the Flutter SDK.

To produce the problem, run the attached application code using google_mobile_ads: 1.0.1 and Flutter 2.8.0.

Video sample, code sample and flutter doctor -v output produced by @maheshmnj

Code sample
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: HomeScreen());
  }
}



class HomeScreen extends StatefulWidget {
  const HomeScreen({Key? key}) : super(key: key);

  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Expanded(child: ListView.builder(itemBuilder: (context, index) {
            return ListTile(
              title: Text('Item $index'),
              onTap: () {
                Navigator.push(context, MaterialPageRoute(builder: (context) {
                  return const ProducDetailPage();
                }));
              },
            );
          })),
          const CustomBannerAd()
        ],
      ),
    );
  }
}

class ProducDetailPage extends StatelessWidget {
  const ProducDetailPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Produc Detail'),
        ),
        body: Column(children: const [
          SizedBox(
            height: 150,
            child: Placeholder(
              color: Colors.red,
            ),
          ),
          SizedBox(
            height: 150,
            child: Placeholder(
              color: Colors.green,
            ),
          ),
          CustomBannerAd()
        ]));
  }
}

class CustomBannerAd extends StatefulWidget {
  const CustomBannerAd({Key? key}) : super(key: key);

  @override
  _CustomBannerAdState createState() => _CustomBannerAdState();
}

class _CustomBannerAdState extends State<CustomBannerAd> {
  BannerAd? _anchoredAdaptiveAd;
  var _isLoaded = false;
  late Orientation _currentOrientation;

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();

    _currentOrientation = MediaQuery.of(context).orientation;
    _loadAd();
  }

  @override
  void dispose() {
    super.dispose();

    _anchoredAdaptiveAd?.dispose();
  }

  Future<void> _loadAd() async {
    await _anchoredAdaptiveAd?.dispose();

    if (mounted) {
      setState(() {
        _anchoredAdaptiveAd = null;
        _isLoaded = false;
      });
    }

    final AnchoredAdaptiveBannerAdSize? size =
        await AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(
            MediaQuery.of(context).size.width.truncate());

    if (size == null) {
      debugPrint('Unable to get height of anchored banner.');
      return;
    }

    _anchoredAdaptiveAd = BannerAd(
      adUnitId: Platform.isAndroid
          ? 'ca-app-pub-3940256099942544/6300978111'
          : 'ca-app-pub-3940256099942544/2934735716',
      size: size,
      request: const AdRequest(
        nonPersonalizedAds: false,
      ),
      listener: BannerAdListener(
        onAdLoaded: (Ad ad) {
          debugPrint("Ad loaded");
          if (mounted) {
            setState(() {
              _anchoredAdaptiveAd = ad as BannerAd;
              _isLoaded = true;
            });
          }
        },
        onAdFailedToLoad: (Ad ad, LoadAdError error) {
          debugPrint('$BannerAd failedToLoad: $error');
          ad.dispose();
        },
        onAdOpened: (Ad ad) => debugPrint('$BannerAd onAdOpened.'),
        onAdClosed: (Ad ad) => debugPrint('$BannerAd onAdClosed.'),
      ),
    );

    return _anchoredAdaptiveAd?.load();
  }

  @override
  Widget build(BuildContext context) {
    return OrientationBuilder(builder: (context, orientation) {
      if (_currentOrientation == orientation &&
          _anchoredAdaptiveAd != null &&
          _isLoaded) {
        return Container(
          color: Colors.transparent,
          width: _anchoredAdaptiveAd!.size.width.toDouble(),
          height: _anchoredAdaptiveAd?.size.height.toDouble(),
          child: AdWidget(ad: _anchoredAdaptiveAd!),
        );
      }

      // Reload the ad if the orientation changes.
      if (_currentOrientation != orientation) {
        _currentOrientation = orientation;
        _loadAd();
      }
      return const SizedBox.shrink();
    });
  }
}

Video showing the bug (Flutter 2.8.0), This bug is not reproducible using Flutter 2.5.3:

stable 2.8.0 stable 2.5.3
flutter-2.8.0-bug.mov
flutter-2.5.3-no-bug.mov

Can presumably be reproduced using any Android 12 device. See flutter doctor -v output for details.

flutter doctor -v
[✓] Flutter (Channel stable, 2.8.0, on macOS 12.0.1 21A559 darwin-arm, locale en-GB)
    • Flutter version 2.8.0 at /Users/mahesh/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cf44000065 (2 days ago), 2021-12-08 14:06:50 -0800
    • Engine revision 40a99c5951
    • Dart version 2.15.0

[✓] 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 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • 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.29.0

[✓] Connected device (3 available)
    • Redmi K20 Pro (mobile) • 192.168.1.6:5555 • android-arm64  • Android 11 (API 30)
    • macOS (desktop)        • macos            • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
    • Chrome (web)           • chrome           • web-javascript • Google Chrome 96.0.4664.93

• No issues found!
@pradipdabhi

This comment has been minimized.

@CripyIce

This comment has been minimized.

@mamuseferha mamuseferha added in triage Presently being triaged by the triage team and removed from: performance template Issues created via a performance issue template labels Dec 16, 2021
@MagnusJohansson
Copy link

Same here. Have published apps in productions stores with this defect, a bit annoying...
It doesn't seem to affect iOS though, only Android.

@mustafa-707
Copy link

SVID_20211216_121014_1.mp4

Same here : flutter 2.8.0 was not appear on 2.5.3

@peterwvj
Copy link
Author

Yes, this is preventing me from publishing to Production as well. Unfortunately downgrading to 2.5.3 its not an option for me due to some other issue.

@maheshj01
Copy link
Member

maheshj01 commented Dec 16, 2021

Hi @peterwvj, Thanks for filing the issue. I am able to reproduce the issue with stable 2.8.0 and the master, 2.9.0-1.0.pre.93, But not on stable 2.5.3. This issue is reproducible only on Android and works fine on IOS.

Screen.Recording.2021-12-16.at.4.18.17.PM.mov

Here is a timeline trace run using skia flag enabled on the stable channel on Xiaomi k20 pro(Android 11), if this can help track down the bug.

flutter doctor -v
[✓] Flutter (Channel stable, 2.8.0, on macOS 12.0.1 21A559 darwin-arm, locale en-GB)
    • Flutter version 2.8.0 at /Users/mahesh/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cf44000065 (8 days ago), 2021-12-08 14:06:50 -0800
    • Engine revision 40a99c5951
    • Dart version 2.15.0

[✓] 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 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • 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.29.0

[✓] Connected device (4 available)
    • Redmi K20 Pro (mobile) • 192.168.1.6:5555                     • android-arm64  • Android 11 (API 30)
    • iPhone 11 (mobile)     • FC644E6C-7F02-40E5-9998-1F0CD162FBD8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 96.0.4664.110

• No issues found!
[✓] Flutter (Channel master, 2.9.0-1.0.pre.93, on macOS 12.0.1 21A559 darwin-arm, locale en-GB)
    • Flutter version 2.9.0-1.0.pre.93 at /Users/mahesh/Documents/flutter_master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 1be7f1ea56 (31 hours ago), 2021-12-14 22:14:07 -0500
    • Engine revision e444009bf4
    • Dart version 2.16.0 (build 2.16.0-109.0.dev)
    • DevTools version 2.9.1

[✓] 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 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • 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.29.0

[✓] Connected device (4 available)
    • Redmi K20 Pro (mobile) • 192.168.1.6:5555                     • android-arm64  • Android 11 (API 30)
    • iPhone 11 (mobile)     • FC644E6C-7F02-40E5-9998-1F0CD162FBD8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 96.0.4664.110

• No issues found!
mahesh@Maheshs-MacBoo
[✓] 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_beta
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (9 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.29.0

[✓] Connected device (4 available)
    • Redmi K20 Pro (mobile) • 192.168.1.6:5555                     • android-arm64  • Android 11 (API 30)
    • iPhone 11 (mobile)     • FC644E6C-7F02-40E5-9998-1F0CD162FBD8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 96.0.4664.110

• No issues found!
logs in profile mode with trace skia
mahesh@Maheshs-MacBook-Air-M1 ads_example % flutter run --profile --trace-skia
Multiple devices found:
Redmi K20 Pro (mobile) • 192.168.1.6:5555                     • android-arm64  • Android 11 (API 30)
iPhone 11 (mobile)     • FC644E6C-7F02-40E5-9998-1F0CD162FBD8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
Chrome (web)           • chrome                               • web-javascript • Google Chrome 96.0.4664.110
[1]: Redmi K20 Pro (192.168.1.6:5555)
[2]: iPhone 11 (FC644E6C-7F02-40E5-9998-1F0CD162FBD8)
[3]: macOS (macos)
[4]: Chrome (chrome)
Please choose one (To quit, press "q/Q"): 1
Launching lib/main.dart on Redmi K20 Pro in profile 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
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
Running Gradle task 'assembleProfile'...                           41.5s
✓  Built build/app/outputs/flutter-apk/app-profile.apk (25.7MB).
Installing build/app/outputs/flutter-apk/app.apk...                 7.8s
W/FlutterActivityAndFragmentDelegate(17880): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.

Flutter run key commands.
h List all available interactive commands.
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on Redmi K20 Pro is available at: http://127.0.0.1:52114/2Dqa1-EPtco=/
W/Ads     (17880): Not retrying to fetch app settings
I/Ads     (17880): Ad failed to load : 3
I/flutter (17880): BannerAd failedToLoad: LoadAdError(code: 3, domain: com.google.android.gms.ads, message: Ad request doesn't meet size requirements. <https://support.google.com/admob/answer/99051
75#2>, responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: []))
The Flutter DevTools debugger and profiler on Redmi K20 Pro is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:52114/2Dqa1-EPtco=/
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
W/ple.ads_exampl(17880): Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (greylist, reflection, allowed)
W/cr_media(17880): Requires BLUETOOTH permission
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
I/flutter (17880): Ad loaded
W/ContentCatcher(17880): Failed to notify a WebView
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129879496, downTime=129879496 } moveCount:0
W/MirrorManager(17880): this model don't Support
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129879721, downTime=129879496 } moveCount:17
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129880106, downTime=129880106 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129880417, downTime=129880106 } moveCount:25
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129881031, downTime=129881031 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129881275, downTime=129881031 } moveCount:16
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129882532, downTime=129882532 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129882977, downTime=129882532 } moveCount:35
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129883372, downTime=129883372 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129883640, downTime=129883372 } moveCount:23
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129884625, downTime=129884625 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129884759, downTime=129884625 } moveCount:0
D/DynamitePackage(17880): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
I/flutter (17880): Ad loaded
W/ContentCatcher(17880): Failed to notify a WebView
W/System  (17880): A resource failed to call release. 
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129928691, downTime=129928691 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129928806, downTime=129928691 } moveCount:0
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 3 lines
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129932270, downTime=129932270 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129932402, downTime=129932270 } moveCount:0
D/DynamitePackage(17880): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
I/flutter (17880): Ad loaded
W/ContentCatcher(17880): Failed to notify a WebView
W/System  (17880): A resource failed to call release. 
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129941855, downTime=129941855 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129941971, downTime=129941855 } moveCount:0
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 3 lines
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=129943322, downTime=129943322 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=129943456, downTime=129943322 } moveCount:0
D/DynamitePackage(17880): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
I/flutter (17880): Ad loaded
W/ContentCatcher(17880): Failed to notify a WebView
W/System  (17880): A resource failed to call release. 
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
W/ContentCatcher(17880): Failed to notify a WebView
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 1 line
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/flutter (17880): Ad loaded
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130062925, downTime=130062925 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130063015, downTime=130062925 } moveCount:0
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 4 lines
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130063577, downTime=130063577 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130063778, downTime=130063577 } moveCount:14
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130064264, downTime=130064264 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130064407, downTime=130064264 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130064827, downTime=130064827 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130064918, downTime=130064827 } moveCount:0
D/DynamitePackage(17880): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
I/flutter (17880): Ad loaded
W/ContentCatcher(17880): Failed to notify a WebView
W/System  (17880): A resource failed to call release. 
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130066299, downTime=130066299 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130066415, downTime=130066299 } moveCount:0
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 3 lines
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
W/ContentCatcher(17880): Failed to notify a WebView
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 1 line
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/flutter (17880): Ad loaded
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
W/ContentCatcher(17880): Failed to notify a WebView
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 1 line
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/flutter (17880): Ad loaded
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130153114, downTime=130153114 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130153340, downTime=130153114 } moveCount:19
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130153953, downTime=130153953 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130154129, downTime=130153953 } moveCount:13
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130155121, downTime=130155121 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130155265, downTime=130155121 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130155866, downTime=130155866 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130155921, downTime=130155866 } moveCount:0
D/DynamitePackage(17880): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
I/flutter (17880): Ad loaded
W/ContentCatcher(17880): Failed to notify a WebView
W/System  (17880): A resource failed to call release. 
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130157192, downTime=130157192 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130157275, downTime=130157192 } moveCount:0
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 3 lines
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130157814, downTime=130157814 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130157989, downTime=130157814 } moveCount:13
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130158206, downTime=130158206 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130158442, downTime=130158206 } moveCount:1
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130158688, downTime=130158688 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130158754, downTime=130158688 } moveCount:0
D/DynamitePackage(17880): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
W/Ads     (17880): Not retrying to fetch app settings
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
I/flutter (17880): Ad loaded
W/ContentCatcher(17880): Failed to notify a WebView
W/System  (17880): A resource failed to call release. 
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130159952, downTime=130159952 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130160027, downTime=130159952 } moveCount:0
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 3 lines
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130160472, downTime=130160472 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130160672, downTime=130160472 } moveCount:15
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130160965, downTime=130160965 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130161217, downTime=130160965 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=130161510, downTime=130161510 } moveCount:0
D/MIUIInput(17880): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=130161584, downTime=130161510 } moveCount:0
D/DynamitePackage(17880): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
I/flutter (17880): Ad loaded
W/ContentCatcher(17880): Failed to notify a WebView
W/System  (17880): A resource failed to call release. 
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
W/ContentCatcher(17880): Failed to notify a WebView
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 1 line
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/flutter (17880): Ad loaded
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
W/ContentCatcher(17880): Failed to notify a WebView
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 1 line
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/flutter (17880): Ad loaded
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
I/ple.ads_exampl(17880): Waiting for a blocking GC ProfileSaver
I/ple.ads_exampl(17880): WaitForGcToComplete blocked ProfileSaver on ProfileSaver for 13.643ms
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
W/ContentCatcher(17880): Failed to notify a WebView
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 1 line
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/flutter (17880): Ad loaded
I/Ads     (17880): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("7533D24B76F3D928E20EB84A8C420B39")) to get test ads on this device.
I/AudioManager(17880): In isSpeakerphoneOn(), calling application: com.example.ads_example
D/EgretLoader(17880): EgretLoader(Context context)
D/EgretLoader(17880): The context is not activity
I/DynamiteModule(17880): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:214106404
I/DynamiteModule(17880): Selected remote version of com.google.android.gms.ads.dynamite, version >= 214106404
W/ContentCatcher(17880): Failed to notify a WebView
W/ContentCatcher(17880): Failed to notify a WebView
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/chatty  (17880): uid=10919(com.example.ads_example) identical 1 line
W/Ads     (17880): #004 The webview is destroyed. Ignoring action.
I/flutter (17880): Ad loaded

Edit: This issue is only reproducible when using the ads plugin on stable 2.8.0 and works fine on stable 2.5.3.

cc: @blasten

@maheshj01 maheshj01 added found in release: 2.8 Found to occur in 2.8 found in release: 2.9 Found to occur in 2.9 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-android Android applications specifically c: performance Relates to speed or footprint issues (see "perf:" labels) c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. f: routes Navigator, Router, and related APIs. and removed in triage Presently being triaged by the triage team labels Dec 16, 2021
@maheshj01 maheshj01 changed the title Flutter 2.8.0 performance issue with google_mobile_ads [Android] Severe glitch when navigating to a screen with google_mobile_ads Dec 16, 2021
@CodingWithTashi
Copy link

Heard flutter 2.8 has improve in terms of app performance and just upgrated to latest version and Now I am seeing glitch issue while navigating(Banner Ads). Funny things is that as long as you have ads in both screen ie. it work fine. It seems like I have to add ads in all screen to make it work otherwise downgrade the flutter version.
Please check and update.

@westlinkin

This comment has been minimized.

@ghost

This comment has been minimized.

@mustafa-707

This comment has been minimized.

@jason-simmons
Copy link
Member

This started with flutter/engine@866db62

During the transition between the screens there may be a PlatformViewsController.onEndFrame callback where the currentFrameUsedPlatformViewIds set briefly becomes empty.

This will result in a call to FlutterView.revertImageView which will eventually call FlutterRenderer.startRenderingToSurface. startRenderingToSurface will do a Rasterizer::Teardown before restarting the rasterizer for the new surface.

The Rasterizer::Teardown then does the SurfacePool::DestroyLayers call added in flutter/engine@866db62, causing the flickering.

@blasten

@muhammadanas759

This comment has been minimized.

@westlinkin

This comment has been minimized.

@AgentNemo

This comment has been minimized.

@q384264619

This comment has been minimized.

@westlinkin
Copy link

The latest 2.10 version still got this problem. For first time only though. pop the second screen and push again, the blink goes away.

@CodingWithTashi
Copy link

CodingWithTashi commented Feb 4, 2022

Just noticed after deployed app to production, It is bit annoying too. Thought issue was fixed, Please look into it. I am also using flutter latest version which is flutter 2.10

@marcellocamara
Copy link

This problem was much worse in stable version 2.8.1
On the new flutter stable version 2.10.0, with dart 2.16.0, is much better. But it is not fixed 100% yet.
I can also see the glitch 😢

@CarGuo
Copy link

CarGuo commented Feb 8, 2022

I'm testing in the 2.10 stable version and the issue was reproducible sometime , look like thee video below:

Screenrecorder-2022-02-08-13-40-48-945.mp4
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 2.10.0, on macOS 12.1 21C52 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.5)
[!] Proxy Configuration
    ! NO_PROXY is not set
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

@westlinkin
Copy link

it's almost two month, I am still using version 2.5.3 to build android app.

@blasten
Copy link

blasten commented Feb 8, 2022

I modified the example a little bit, and I can see the issue now. I'm taking a look at the issue.

Code
void main() {
  WebView.platform = SurfaceAndroidWebView();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: HomeScreen());
  }
}

class HomeScreen extends StatefulWidget {
  const HomeScreen({Key? key}) : super(key: key);

  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            ListTile(
              title: Text('Red'),
              onTap: () {
                Navigator.push(context, MaterialPageRoute(builder: (context) {
                  return const ProducDetailPage();
                }));
              },
            ),
            ListTile(
              title: Text('Green'),
              onTap: () {
                Navigator.push(context, MaterialPageRoute(builder: (context) {
                  return const ProductDetailPage2();
                }));
              },
            ),
            SizedBox(
              height: 150,
              child: WebView(
                initialUrl: 'https://flutter.dev',
              ),
            ),
          ],
        ),
      ),
    );
  }
}

class ProducDetailPage extends StatelessWidget {
  const ProducDetailPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Produc Detail'),
        ),
        body: Column(children: const [
          Padding(
            padding: EdgeInsets.all(8.0),
            child: SizedBox(
              height: 150,
              child: Placeholder(
                color: Colors.red,
              ),
            ),
          ),
          SizedBox(
            height: 150,
            child: WebView(
              initialUrl: 'https://flutter.dev',
            ),
          ),
        ]));
  }
}

class ProductDetailPage2 extends StatelessWidget {
  const ProductDetailPage2({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Produc Detail'),
        ),
        body: Column(children: const [
          SizedBox(
            height: 150,
            child: Placeholder(
              color: Colors.green,
            ),
          ),
        ]));
  }
}

@blasten
Copy link

blasten commented Feb 9, 2022

I synced to the commit prior to flutter/engine@866db62, and I'm still able to see a glitch if I run the code snippet I shared above.

The good news is that once flutter/engine#31198 is merged, this issue will be fixed from its root cause and won't happen again.

@shahoit

This comment was marked as off-topic.

@westlinkin
Copy link

@blasten Will this be released in 2.10 hot fix?

@chitgoks
Copy link

i dont have a problem with flutter 2.10 and google ads 1.1.0 anymore.

@mustafa-707
Copy link

flutter 2.10 and google ads ^1.1.0 . and it show some time the flicking

@railsonsm
Copy link

flutter 2.10 and google_mobile_ads ^1.1.0 . It seems to me that the problem is still occurring. Right when I updated it stopped blinking but soon after it came back

@lhdio
Copy link

lhdio commented Feb 19, 2022

flutter 2.10.2 and google_mobile_ads: ^1.1.0 . It seems to me that the problem is still occurring. :(

@Waheed388
Copy link

Flutter 2.10.2,
Dart 2.16.1,
google_mobile_ads: ^1.1.0,

Such a turnoff. Cannot release the app to the play store because of this issue.

@lhdio
Copy link

lhdio commented Mar 3, 2022

flutter 2.10.3 and google_mobile_ads: ^1.1.0 . It seems to me that the problem is still occurring. :(

@CarGuo
Copy link

CarGuo commented Mar 5, 2022

I'm testing in the 2.10 stable version and the issue was reproducible sometime , look like thee video below:

Screenrecorder-2022-02-08-13-40-48-945.mp4

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 2.10.0, on macOS 12.1 21C52 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.5)
[!] Proxy Configuration
    ! NO_PROXY is not set
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

2.10.3 still occurring , in my case with webView_flutter :

1、A page -> webview page -> B page , when webview page open B page ,sometime A page UI will twinkle in B page .
2、when B page back to webview page , then back to A page, sometime B page UI will twinkle in A page suddenly.

if I only A page -> webview page , I can resolve this issue by render Container replace WebView when Navigator.pop .

@michelesandroni
Copy link

Any progress on this? Until this gets fixed I'm stuck on 2.5.3 and with me probably most people using the ads package.
Multiple users have confirmed this still happens with 2.10.3.
Apparently support for ad-based apps is not a priority?

@mustafa-707
Copy link

same here stuck on 2.5.3

@zanderso
Copy link
Member

Hi folks, I believe the fix for this from @blasten is in the 2.12 beta. (@blasten Is that the right commit?) Please give it a try.

@marcellocamara
Copy link

marcellocamara commented Mar 21, 2022

@zanderso

is in the 2.12 beta.

I've tested on 2.12.0-4.1.pre with dart 2.17.0-182.1.beta using PageView with BannerAd inside pages and the bug still exists. 😢
Can anyone test it to confirm too ?

@blasten
Copy link

blasten commented Mar 21, 2022

The ultimate fix for this issue is available on the master channel. @marcellocamara can you try building with the master channel?

@marcellocamara
Copy link

The ultimate fix for this issue is available on the master channel. @marcellocamara can you try building with the master channel?

@blasten I've tested on :

environment:
  sdk: ">=2.17.0-222.0.dev <3.0.0"
  flutter: "2.13.0-0.0.pre.168"

No glitches found 👍🏻

@blasten
Copy link

blasten commented Mar 21, 2022

Thanks for confirming.

If someone is having this issue. please try the steps described above, and comment
if you are having issues after trying.

@github-actions
Copy link

github-actions bot commented Apr 5, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: performance Relates to speed or footprint issues (see "perf:" labels) c: regression It was better in the past than it is now customer: crowd Affects or could affect many people, though not necessarily a specific customer. engine flutter/engine repository. See also e: labels. f: routes Navigator, Router, and related APIs. found in release: 2.8 Found to occur in 2.8 found in release: 2.9 Found to occur in 2.9 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

Successfully merging a pull request may close this issue.