Skip to content

"flutter widget-preview start --web-server" sometimes fails, printing errors about ADB (and starting the ADB daemon?) #173615

@DanTup

Description

@DanTup

Steps to reproduce

Sometimes (possibly the first time after a boot?), flutter widget-preview start --web-server fails to run, printing an error about not finding adb and starting the daemon, before quitting.

cc @bkonyi

Expected results

  • The preview should start in web-server mode
  • Errors should not be printed about adb (Flutter knows where adb is and can usually execute it fine)
  • The adb daemon should not be started (there was no request to run anything on Android)
  • The preview should be usable and the process should not terminate

Actual results

An error is printed and the process terminates:

PS D:\Dev\Test Projects\flutter_counter> flutter widget-preview start --web-server
Finding previews in D:\Dev\Test Projects\flutter_counter...
Found 2 previews.
Launching the Widget Preview Scaffold...
Launching lib\main.dart on Web Server in debug mode...
Unable to run "adb", check your Android SDK installation and ANDROID_HOME environment variable:
C:\Users\danny\AppData\Local\Android\sdk\platform-tools\adb.exe
Error details: Process exited abnormally with exit code 1:
* daemon not running; starting now at tcp:5037
could not read ok from ADB Server
* failed to start daemon
adb.exe: failed to check server version: cannot connect to daemon

(note: I don't have adb on PATH, however Flutter knows where it is and can run it normally for other commands, like flutter devices / flutter emulators).

The second time, everything starts fine:

PS D:\Dev\Test Projects\flutter_counter> flutter widget-preview start --web-server
Finding previews in D:\Dev\Test Projects\flutter_counter...
Found 2 previews.
Launching the Widget Preview Scaffold...
Launching lib\main.dart on Web Server in debug mode...
lib\main.dart is being served at http://localhost:55513
The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the Chrome or Edge devices for an improved development
workflow.
Done loading previews.

Code sample

N/A

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[!] Flutter (Channel master, 3.33.0-1.0.pre-1343, on Microsoft Windows [Version 10.0.26100.4652], locale en-GB) [3.4s]
    • Flutter version 3.33.0-1.0.pre-1343 on channel master at D:\Dev\Google\Flutter\Flutter main
    ! Warning: `dart` on your path resolves to D:\Tools\Dart\Stable\bin\dart.exe, which is not inside your current Flutter SDK checkout at
      D:\Dev\Google\Flutter\Flutter main. Consider adding D:\Dev\Google\Flutter\Flutter main\bin to the front of your path.
    ! Upstream repository git@github.com:DanTup/flutter.git is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to git@github.com:DanTup/flutter.git to dismiss this error.
    • Framework revision 1590543f67 (3 days ago), 2025-08-08 23:18:19 -0400
    • Engine revision d77a9629f2
    • Dart version 3.10.0 (build 3.10.0-81.0.dev)
    • DevTools version 2.49.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, enable-lldb-debugging
    • 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 Pro 64-bit, 24H2, 2009) [816ms]

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1,974ms]
    • Android SDK at C:\Users\danny\AppData\Local\Android\sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-36, build-tools 35.0.0
    • 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 21.0.6+-13355223-b631.42)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

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

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.5) [55ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.10.35122.118
    • Windows 10 SDK version 10.0.26100.0

[✓] Connected device (3 available) [97ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26100.4652]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 139.0.7258.66
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 138.0.3351.77

[✓] Network resources [510ms]
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: widget previewsIssues related to the Widget Previewer toolingteam-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