flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.55k stars 27.33k forks source link

The Flutter Daemon has terminated #87261

Closed ansidev closed 3 years ago

ansidev commented 3 years ago

Environment:

OS: macOS BigSur 11.4 IDE: Android Studio Arctic Fox 2020.3.1 Simulator: iOS Simulator

Steps to Reproduce

  1. Install CloudFlare WARP from https://1.1.1.1
  2. Enable WARP mode.
  3. Disable WARP mode.
  4. Something went wrong and "The Flutter Daemon has terminated"

Additional information

After the error was occurred, Docker cannot work normally because Docker containers cannot not discover the other ones, so I think this issue relates to network/proxy.

The current workaround solution: restart OS.

Logs

Logs 1. Run `flutter doctor -v` ```log [✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en) • Flutter version 2.2.3 at /Users/mac/tools/flutter • Framework revision f4abaa0735 (4 weeks ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/mac/Library/Android/sdk • Platform android-31, build-tools 30.0.3 • ANDROID_HOME = /Users/mac/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/mac/Library/Android/sdk • Java binary at: /Users/mac/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/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 12.5.1, Build version 12E507 • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [!] Android Studio (version 2020.3) • 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 ✗ Unable to find bundled Java version. • Try updating or re-installing Android Studio. [✓] Android Studio (version 4.2) • Android Studio at /Users/mac/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/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 Ultimate Edition (version 2021.1.3) • IntelliJ at /Users/mac/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app • Flutter plugin version 58.0.3 • Dart plugin version 211.7665 [✓] VS Code (version 1.58.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.24.0 [☠] Connected device (the doctor check crashed) ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues. ✗ Exception: Unable to run "adb", check your Android SDK installation and ANDROID_SDK_ROOT environment variable: /Users/mac/Library/Android/sdk/platform-tools/adb • #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 AndroidDevices.pollingGetDevices (package:flutter_tools/src/android/android_device_discovery.dart:78:7) #2 PollingDeviceDiscovery._populateDevices (package:flutter_tools/src/device.dart:397:54) #3 Future.wait. (dart:async/future.dart) #4 DeviceManager.getAllConnectedDevices (package:flutter_tools/src/device.dart:163:40) #5 DeviceValidator.validate (package:flutter_tools/src/doctor.dart:510:34) #6 asyncGuard. (package:flutter_tools/src/base/async_guard.dart:111:24) ! Doctor found issues in 2 categories. ``` 2. Run `ping 127.0.0.1` ```log PING 127.0.0.1 (127.0.0.1): 56 data bytes ping: sendto: Can't assign requested address ping: sendto: Can't assign requested address Request timeout for icmp_seq 0 ping: sendto: Can't assign requested address Request timeout for icmp_seq 1 ping: sendto: Can't assign requested address Request timeout for icmp_seq 2 ping: sendto: Can't assign requested address Request timeout for icmp_seq 3 ping: sendto: Can't assign requested address Request timeout for icmp_seq 4 ping: sendto: Can't assign requested address Request timeout for icmp_seq 5 ^C --- 127.0.0.1 ping statistics --- 7 packets transmitted, 0 packets received, 100.0% packet loss ``` 3. Run `adb kill-server && adb start-server` ```log cannot connect to daemon at tcp:5037: Connection refused * daemon not running; starting now at tcp:5037 ADB server didn't ACK Full server startup log: /var/folders/rg/2ghbpv594593xwc66z446w5w0000gn/T//adb.501.log Server had pid: 44165 --- adb starting (pid 44165) --- adb I 07-29 15:19:33 44165 3328998 main.cpp:63] Android Debug Bridge version 1.0.41 adb I 07-29 15:19:33 44165 3328998 main.cpp:63] Version 31.0.3-7562133 adb I 07-29 15:19:33 44165 3328998 main.cpp:63] Installed as /Users/mac/Library/Android/sdk/platform-tools/adb adb I 07-29 15:19:33 44165 3328998 main.cpp:63] adb E 07-29 15:19:33 44165 3329001 usb_osx.cpp:160] Unable to create an interface plug-in (e00002be) adb E 07-29 15:19:33 4827 2981413 usb_osx.cpp:160] Unable to create an interface plug-in (e00002be) adb F 07-29 15:19:34 44165 3328998 main.cpp:160] could not install *smartsocket* listener: Address already in use * failed to start daemon error: cannot connect to daemon ```
ansidev commented 3 years ago

Relate issue: https://github.com/flutter/flutter/issues/72101

maheshj01 commented 3 years ago

Hi @ansidev, It looks like you have two versions of Android studio installed and probably there is an issue with adb could you please share the screenshot of Android Studio settings by going to sdk settings => Android Sdk=> sdk tools.

ansidev commented 3 years ago

Hi @ansidev, It looks like you have two versions of Android studio installed and probably there is an issue with adb could you please share the screenshot of Android Studio settings by going to sdk settings => Android Sdk=> sdk tools.

Screen Shot 2021-07-29 at 18 39 34

maheshj01 commented 3 years ago

The current workaround solution: restart OS.

Do you mean each time you restart the OS the error does not occur?

Can you also try resinstalling

by uncheck => apply and recheck => apply on those two items

then please share the output of

flutter doctor -v
ansidev commented 3 years ago

@maheshmnj

The following log is the output while flutter is working.

  1. Uncheck "Android SDK build tools"
Logs ```log [✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en) • Flutter version 2.2.3 at /Users/mac/tools/flutter • Framework revision f4abaa0735 (4 weeks ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4 [!] Android toolchain - develop for Android devices • Android SDK at /Users/mac/Library/Android/sdk ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location. • ANDROID_HOME = /Users/mac/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/mac/Library/Android/sdk ✗ No valid Android SDK platforms found in /Users/mac/Library/Android/sdk/platforms. Candidates were: - android-22 - android-31 - android-30 - android-29 - android-28 • Try re-installing or updating your Android SDK, visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.5.1, Build version 12E507 • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [!] Android Studio (version 2020.3) • 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 ✗ Unable to find bundled Java version. • Try updating or re-installing Android Studio. [✓] Android Studio (version 4.2) • Android Studio at /Users/mac/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/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 Ultimate Edition (version 2021.1.3) • IntelliJ at /Users/mac/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app • Flutter plugin version 58.0.3 • Dart plugin version 211.7665 [✓] VS Code (version 1.58.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.24.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 11.4 20F71 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107 ! Doctor found issues in 2 categories. ```
  1. [1] + Uncheck "Android SDK command line tools"
    Logs
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en)
    • Flutter version 2.2.3 at /Users/mac/tools/flutter
    • Framework revision f4abaa0735 (4 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[!] Android toolchain - develop for Android devices
    • Android SDK at /Users/mac/Library/Android/sdk
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

    • ANDROID_HOME = /Users/mac/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/mac/Library/Android/sdk
    ✗ No valid Android SDK platforms found in /Users/mac/Library/Android/sdk/platforms. Candidates were:
        - android-22
        - android-31
        - android-30
        - android-29
        - android-28
    • Try re-installing or updating your Android SDK,
      visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2020.3)
    • 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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] Android Studio (version 4.2)
    • Android Studio at /Users/mac/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/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 Ultimate Edition (version 2021.1.3)
    • IntelliJ at /Users/mac/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 58.0.3
    • Dart plugin version 211.7665

[✓] VS Code (version 1.58.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.24.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.4 20F71 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 92.0.4515.107

! Doctor found issues in 2 categories.

  1. Recheck "Android SDK build tools"
Logs ```log [✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en) • Flutter version 2.2.3 at /Users/mac/tools/flutter • Framework revision f4abaa0735 (4 weeks ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4 [!] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/mac/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/mac/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/mac/Library/Android/sdk • Java binary at: /Users/mac/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) ✗ Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.5.1, Build version 12E507 • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [!] Android Studio (version 2020.3) • 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 ✗ Unable to find bundled Java version. • Try updating or re-installing Android Studio. [✓] Android Studio (version 4.2) • Android Studio at /Users/mac/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/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 Ultimate Edition (version 2021.1.3) • IntelliJ at /Users/mac/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app • Flutter plugin version 58.0.3 • Dart plugin version 211.7665 [✓] VS Code (version 1.58.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.24.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 11.4 20F71 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107 ! Doctor found issues in 2 categories. ```
  1. [3] + Recheck "Android SDK command line tools"
    Logs
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en)
    • Flutter version 2.2.3 at /Users/mac/tools/flutter
    • Framework revision f4abaa0735 (4 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mac/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Users/mac/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/mac/Library/Android/sdk
    • Java binary at: /Users/mac/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/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 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2020.3)
    • 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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] Android Studio (version 4.2)
    • Android Studio at /Users/mac/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085/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 Ultimate Edition (version 2021.1.3)
    • IntelliJ at /Users/mac/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 58.0.3
    • Dart plugin version 211.7665

[✓] VS Code (version 1.58.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.24.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.4 20F71 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 92.0.4515.107

! Doctor found issues in 1 category.

maheshj01 commented 3 years ago

@ansidev, The issue is more likely because after installing cloud flare probably its modifying the path variable and the sdk path is not being located, could you try running

echo $PATH

before and after installing cloudflare to ensure the sdk path remains unmodified

Also this how you can set the path to you android sdk using the flutter cli https://stackoverflow.com/a/52926825/8253662

chungbd commented 3 years ago

@ansidev you're not alone with this issue.

I also used CloudFlare WARP and got this issue.

I recently have deleted CloudFlare WARP not to interrupt my work and am following this issue to catch a reason why it happened.

Thank you in advance @maheshmnj, you're the kindly man.

ansidev commented 3 years ago

After some tests, I confirm that the problem comes from CloudFlare WARP. So I will close this issue.

ansidev commented 3 years ago

@ansidev you're not alone with this issue.

I also used CloudFlare WARP and got this issue.

I recently have deleted CloudFlare WARP not to interrupt my work and am following this issue to catch a reason why it happened.

Thank you in advance @maheshmnj, you're the kindly man.

The problem is if you turn on WARP mode, your computer will connect to the internet via VPN. But after that, if you turn off WARP mode, something relates to network config was not reverted and any application cannot connect to localhost (flutter, docker,...). So the flutter daemon cannot start or continue to work normally.

maheshj01 commented 3 years ago

glad you found the cause :)

github-actions[bot] commented 3 years ago

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.