Content-Length: 395159 | pFad | https://github.com/flutter/flutter/issues/148347

37 [Android Emulator] Child pages are not rendered after exiting a nested initial page with the back gesture and launching from the Android launcher. · Issue #148347 · flutter/flutter · GitHub
Skip to content

[Android Emulator] Child pages are not rendered after exiting a nested initial page with the back gesture and launching from the Android launcher. #148347

@yamashita-room-335

Description

@yamashita-room-335

At first I thought it was a bug on the library side (https://pub.dev/packages/auto_route), but I am reporting it here because it probably only occurs in the Android Emulator.

Please check Issue (Milad-Akarie/auto_route_library#1947) for the results of defect verification by several other people.

I also reported it to Google's Issue Tracker (https://issuetracker.google.com/issues/338667188), but they commented that I should submit it here.

Environment

Android Emulator version 34.2.13
Android Emulator hypervisor driver (installer) version 2.2.0

flutter doctor -v
PS C:\projects\sampleForIssue> flutter doctor -v
[√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Version 10.0.22631.3447], locale ja-JP)
    • Flutter version 3.19.6 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (13 days ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc3)
    • Android SDK at C:\Users\sugur\AppData\Local\Android\sdk
    • Platform android-34, build-tools 35.0.0-rc3
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.9.34714.143
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2023.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.10+0--11572160)

[√] VS Code (version 1.88.1)
    • VS Code at C:\Users\sugur\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 14 (API 34) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22631.3447]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 124.0.6367.91
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 124.0.2478.67

[√] Network resources
    • All expected network resources are available.

• No issues found!

Example Code

Example Code

pubspec.yaml:

name: sample_for_issue
description: "A new Flutter project."
publish_to: 'none'
version: 1.0.0+1
environment:
  sdk: '>=3.3.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.8
  auto_route: 8.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^3.0.2
  auto_route_generator: ^8.0.0
  build_runner: ^2.4.9

flutter:
  uses-material-design: true

app_router.dart:

import 'package:auto_route/auto_route.dart';

import 'main.dart';

part 'app_router.gr.dart';

@AutoRouterConfig(replaceInRouteName: 'Page,Route')
class AppRouter extends _$AppRouter {
  @override
  List<AutoRoute> get routes => [
        AutoRoute(
          page: ParentRoute.page,
          initial: true,
          children: [
            AutoRoute(page: ChildRoute.page, initial: true),
          ],
        ),
      ];
}

main.dart:

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

import 'app_router.dart';

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

class MyApp extends StatelessWidget {
  MyApp({super.key});

  final _appRouter = AppRouter();

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      theme: ThemeData(
        useMaterial3: true,
      ),
      routerConfig: _appRouter.config(),
    );
  }
}

@RoutePage()
class ParentPage extends StatelessWidget {
  const ParentPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Stack(
      fit: StackFit.expand,
      children: [
        Container(
          color: Theme.of(context).colorScheme.secondaryContainer,
        ),
        const AutoRouter(),
      ],
    );
  }
}

@RoutePage()
class ChildPage extends StatelessWidget {
  const ChildPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.transparent,
      appBar: AppBar(
        title: const Text('Child'),
      ),
      body: const Center(
        child: Column(
          children: [
            Text(
              'Child',
            ),
          ],
        ),
      ),
    );
  }
}

Procedure

  1. Install the app and launch it (either by using the Run button in Android Studio or by installing the built Release APK, in both cases the problem occurred).
    ChildPage is displayed at this time.

  2. Perform the back process (whether by back key or gesture by swiping, the bug occurred in both cases).

  3. Tap the app in the launcher.

-> ParentPage is rendered, but ChildPage is not.

issue.mp4
Log(~ parts is my added)
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...
Debug service listening on ws://127.0.0.1:59902/WsRGL123o4A=/ws
Syncing files to device sdk gphone64 x86 64...

 ~ back pressed ~

D/EGL_emulation(18126): app_time_stats: avg=12504.26ms min=12.23ms max=24996.28ms count=2
W/WindowOnBackDispatcher(18126): sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@2140e8e
W/ample_for_issue(18126): Cleared Reference was only reachable from finalizer (only reported once)

 ~ app icon tapped on launcher ~

W/OpenGLRenderer(18126): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
W/OpenGLRenderer(18126): Failed to initialize 101010-2 format, error = EGL_SUCCESS
E/OpenGLRenderer(18126): Unable to match the desired swap behavior.
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
E/emuglGLESv2_enc(18126): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502

This may be related to a bug in the emulator, as the following logs are displayed.

#146890

E/emuglGLESv2_enc(17550): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2183 GL error 0x502

According to this Issue (#146890), Android Emulator version 35 is the cause of the bug and that version has already been removed.
However, I am encountering this bug with Android Emulator version 34.2.13.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listplatform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/flutter/flutter/issues/148347

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy