无法 运行 "adb",请检查您的 Android SDK 安装和 ANDROID_SDK_ROOT 环境变量:...\Android\Sdk\platform-tools\adb.exe

Unable to run "adb", check your Android SDK installation and ANDROID_SDK_ROOT environment variable: ...\Android\Sdk\platform-tools\adb.exe

当我启动项目弹出窗口时显示“Flutter daemon terminate”,当启动 flutter 应用程序时它显示“No Connected Devices Found”对话框。然后我 运行 flutter doctor -v 医生发现​​问题在:

Connected device (the doctor check crashed)
X 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.
X Exception: Unable to run "adb", check your Android SDK installation and ANDROID_SDK_ROOT environment variable: C:\Users\Pulsara\AppData\Local\Android\Sdk\platform-tools\adb.exe
• #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)
  <asynchronous suspension>
  #2      PollingDeviceDiscovery._populateDevices (package:flutter_tools/src/device.dart:413:54)
  <asynchronous suspension>
  #3      Future.wait.<anonymous closure> (dart:async/future.dart)
  <asynchronous suspension>
  #4      DeviceManager.getAllConnectedDevices (package:flutter_tools/src/device.dart:170:40)
  <asynchronous suspension>
  #5      DeviceValidator.validate (package:flutter_tools/src/doctor.dart:515:34)
  <asynchronous suspension>
  #6      asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:24)
  <asynchronous suspension>

我已经在用户变量中将SDK路径设置为ANDROID_SDK_TOOLS,在Path中设置为toolsplatform-tools。并重新安装 platform-tools 也没有解决问题。我想不出解决方案,如果有人能给我一个解决方案,我将不胜感激。

事件日志中显示以下日志:

12/2/2021
12:26 AM    'C:\Users\Pulsara\AppData\Local\Android\Sdk\platform- 
tools\adb.exe start-server' failed -- run manually if necessary

12:26 AM    'C:\Users\Pulsara\AppData\Local\Android\Sdk\platform- 
tools\adb.exe start-server' failed -- run manually if necessary

12:26 AM    * daemon not running; starting now at tcp:5037

12:26 AM    * daemon started successfully

12:26 AM    Adb connection Error:An existing connection was forcibly 
closed by the remote host

12:26 AM    Cannot reach ADB server, attempting to reconnect.

我还是没能解决问题。

在不执行我在问题中提到的任何步骤后尝试此步骤。

问题出在防病毒程序中。它拒绝在 port 5037 上启动 flutter 守护进程。我只是从我的设备上卸载了防病毒程序。然后它就像一个魅力。