Visitar URL original
Flutter goldens Android on windows not working · Issue #171126 · flutter/flutter · GitHub
Skip to content

Flutter goldens Android on windows not working #171126

Closed

Description

@asaworld

Steps to reproduce

Inside an integration test run using "flutter test integration_test/app_test.dart" on windows and an android emulator or physical device. I have tested this code on a mac with and iOS simulator and it works fine.

await expectLater(find.byWidget(appWidget), matchesGoldenFile("test.png"));

@matanlurey This might be in your wheelhouse as your name keeps popping up as I research the solution to this :-)

Expected results

Takes or compares a snapshot as part of the test

Actual results

01:24 +0 -1: loading C:/code/.../login_test.dart [E]
  Invalid argument(s): Uri c:/code/.../integration_test/login_test.dart must have scheme 'file:'.
  package:path/src/style/windows.dart 86:7                           WindowsStyle.pathFromUri
  package:path/src/context.dart 1040:40                              Context.fromUri
  package:file/src/interface/file_system.dart 158:24                 FileSystem.getPath
  package:file/src/backends/local/local_file_system.dart 26:54       LocalFileSystem.file
  package:flutter_tools/src/base/error_handling_io.dart 139:83       ErrorHandlingFileSystem.file
  package:flutter_tools/src/test/test_golden_comparator.dart 87:19   TestGoldenComparator._processForTestFile
  package:flutter_tools/src/test/test_golden_comparator.dart 153:56  TestGoldenComparator._compareGoldens
  ===== asynchronous gap ===========================
  package:flutter_tools/src/test/test_golden_comparator.dart 126:28  TestGoldenComparator.compare
  ===== asynchronous gap ===========================
  package:flutter_tools/src/test/flutter_platform.dart 559:17        FlutterPlatform._listenToVmServiceForGoldens.<fn>

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Counter App',
      home: Text('Counter App Home Page'),
    );
  }
}

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  group('end-to-end test', () {
    testWidgets('tap on the floating action button, verify counter', (
      tester,
    ) async {
      final appWidget = MyApp();
      await tester.pumpWidget(appWidget);
      await expectLater(find.byWidget(appWidget), matchesGoldenFile("test.png"));
    });
  });
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
flutter doctor -v                                              
[√] Flutter (Channel stable, 3.32.4, on Microsoft Windows [Version 10.0.26100.4351], locale en-US) [758ms]
    • Flutter version 3.32.4 on channel stable at C:\code\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6fba2447e9 (12 days ago), 2025-06-12 19:03:56 -0700
    • Engine revision 8cd19e509d
    • Dart version 3.8.1
    • DevTools version 2.45.1

[√] Windows Version (Windows 11 or higher, 24H2, 2009) [6.1s]

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.9s]
    • Android SDK at C:\Users\asade\AppData\Local\Android\Sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = C:\Users\asade\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

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

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.14.2) [222ms]
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
    • Visual Studio Build Tools 2022 version 17.14.36121.58
    • Windows 10 SDK version 10.0.26100.0

[√] Android Studio (version 2024.2) [40ms]
    • 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.11+0--11852314)

[√] VS Code (version 1.101.1) [35ms]
    • VS Code at C:\Users\asade\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.112.0

[√] Connected device (4 available) [476ms]
    • Pixel 3 (mobile)  • 019XS1UMP • android-arm64  • Android 12 (API 31)
    • Windows (desktop) • windows   • windows-x64    • Microsoft Windows [Version 10.0.26100.4351]
    • Chrome (web)      • chrome    • web-javascript • Google Chrome 137.0.7151.120
    • Edge (web)        • edge      • web-javascript • Microsoft Edge 137.0.3296.93

[√] Network resources [1,513ms]
    • All expected network resources are available.

• No issues found!

Activity

  1. danagbemava-nc commented on Jun 26, 2025

    @danagbemava-nc
    Member

    Reproducible using the test case provided above.
    On a macOS host, the test passes as expected on the android device but on a windows host, it fails. The test also passes when windows is targeted as the host.

    Labeling for further investigation

    flutter doctor -v
    [√] Flutter (Channel master, 3.33.0-1.0.pre.697, on Microsoft Windows [Version 10.0.26100.3194], locale en-US) [8.4s]
        • Flutter version 3.33.0-1.0.pre.697 on channel master at C:\Users\Deana\fvm\versions\master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 961ce3ec82 (4 hours ago), 2025-06-26 00:08:58 -0400
        • Engine revision 961ce3ec82
        • Dart version 3.9.0 (build 3.9.0-277.0.dev)
        • DevTools version 2.48.0-dev.0
    
    [√] Windows Version (11 Home 64-bit, 24H2, 2009) [3.3s]
    
    [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [4.8s]
        • Android SDK at C:\Users\Deana\AppData\Local\Android\sdk
        • Emulator version 33.1.23.0 (build_id 11150993) (CL:N/A)
        • Platform android-36, build-tools 34.0.0
        • Java binary at: C:\Users\Deana\AppData\Local\Programs\Android Studio\jbr\bin\java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.4+-12508038-b607.1)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web [281ms]
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.6) [276ms]
        • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
        • Visual Studio Community 2022 version 17.13.35931.197
        • Windows 10 SDK version 10.0.22621.0
    
    [√] Android Studio (version 2023.1) [51ms]
        • 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.7+0-b2043.56-10550314)
    
    [√] Android Studio (version 2024.2) [45ms]
        • Android Studio at C:\Users\Deana\AppData\Local\Programs\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 21.0.4+-12508038-b607.1)
    
    [√] VS Code (version 1.98.0) [43ms]
        • VS Code at C:\Users\Deana\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.110.0
    
    [√] Connected device (5 available) [1,118ms]
        • Pixel 7 (mobile)             • 28291FDH2001SA • android-arm64  • Android 16 (API 36)
        • sdk gphone64 x86 64 (mobile) • emulator-5554  • android-x64    • Android 14 (API 34) (emulator)
        • Windows (desktop)            • windows        • windows-x64    • Microsoft Windows [Version 10.0.26100.3194]
        • Chrome (web)                 • chrome         • web-javascript • Google Chrome 137.0.7151.104
        • Edge (web)                   • edge           • web-javascript • Microsoft Edge 137.0.3296.93
    
    [√] Network resources [1,663ms]
        • All expected network resources are available.
    
    • No issues found!
    
    [!] Flutter (Channel stable, 3.32.5, on Microsoft Windows [Version 10.0.26100.3194], locale en-US) [712ms]
        • Flutter version 3.32.5 on channel stable at C:\Users\Deana\fvm\versions\stable
        ! Warning: `flutter` on your path resolves to C:\Users\Deana\fvm\versions\master\bin\flutter, which is not inside your current Flutter SDK checkout at C:\Users\Deana\fvm\versions\stable. Consider adding C:\Users\Deana\fvm\versions\stable\bin to the front of your path.
        ! Warning: `dart` on your path resolves to C:\Users\Deana\fvm\versions\master\bin\dart, which is not inside your current Flutter SDK checkout at C:\Users\Deana\fvm\versions\stable. Consider adding C:\Users\Deana\fvm\versions\stable\bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision fcf2c11572 (2 days ago), 2025-06-24 11:44:07 -0700
        • Engine revision dd93de6fb1
        • Dart version 3.8.1
        • DevTools version 2.45.1
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [√] Windows Version (11 Home 64-bit, 24H2, 2009) [2.9s]
    
    [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [3.1s]
        • Android SDK at C:\Users\Deana\AppData\Local\Android\sdk
        • Platform android-36, build-tools 34.0.0
        • Java binary at: C:\Users\Deana\AppData\Local\Programs\Android Studio\jbr\bin\java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.4+-12508038-b607.1)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web [205ms]
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.6) [202ms]
        • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
        • Visual Studio Community 2022 version 17.13.35931.197
        • Windows 10 SDK version 10.0.22621.0
    
    [√] Android Studio (version 2023.1) [34ms]
        • 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.7+0-b2043.56-10550314)
    
    [√] Android Studio (version 2024.2) [30ms]
        • Android Studio at C:\Users\Deana\AppData\Local\Programs\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 21.0.4+-12508038-b607.1)
    
    [√] VS Code (version 1.98.0) [28ms]
        • VS Code at C:\Users\Deana\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.110.0
    
    [√] Connected device (5 available) [613ms]
        • Pixel 7 (mobile)             • 28291FDH2001SA • android-arm64  • Android 16 (API 36)
        • sdk gphone64 x86 64 (mobile) • emulator-5554  • android-x64    • Android 14 (API 34) (emulator)
        • Windows (desktop)            • windows        • windows-x64    • Microsoft Windows [Version 10.0.26100.3194]
        • Chrome (web)                 • chrome         • web-javascript • Google Chrome 137.0.7151.104
        • Edge (web)                   • edge           • web-javascript • Microsoft Edge 137.0.3296.93
    
    [√] Network resources [706ms]
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
    
  2. added
    a: tests"flutter test", flutter_test, or one of our tests
    platform-androidAndroid applications specifically
    toolAffects the "flutter" command-line tool. See also t: labels.
    platform-windowsBuilding on or for Windows specifically
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    fyi-androidFor the attention of Android platform team
    team-toolOwned by Flutter Tool team
    and removed
    in triagePresently being triaged by the triage team
    on Jun 26, 2025
  3. Eyas commented on Oct 7, 2025

    @Eyas
    Contributor

    The issue is

    final Uri goldensBaseUri = Uri.parse(testPath);

    results in something like:

    c:/Users/xyz/Source/abc/integration_test/app_test.dart

    in Windows, rather than file://..., but

    will require it to be a file:/// URI.

    Calling Uri.parse(c:/x/y/z/) results in a Uri with scheme c.

    I think FlutterPlatform._listenToVmServiceForGoldens should be careful when constructing URIs for windows.

  4. Eyas commented on Oct 7, 2025

    @Eyas
    Contributor

    I believe the correct fix is to replace

    final Uri goldensBaseUri = Uri.parse(testPath);
    with:

    final Uri goldensBaseUri = Uri.file(testPath, windows: IS_WINDOWS);

    where I'm not quite sure if it's okay to substitute IS_WINDOWS with Platform.isWindows there or what.

  5. added a commit that references this issue on Oct 11, 2025
    f982e8b
  6. added a commit that references this issue on Mar 16, 2026
    d8150ef
  7. added a commit that references this issue on Mar 26, 2026
    7e1d9fe
  8. github-actions commented on Mar 30, 2026

    @github-actions

    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.

  9. locked as resolved and limited conversation to collaborators on Mar 30, 2026
  10. added a commit that references this issue on Apr 14, 2026
    e676092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsfound in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyplatform-windowsBuilding on or for Windows specificallyteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions