我遇到了一个问题,flutter 无法运行任何东西,因为它无法找到 ADB。但是,我已经安装了 adb(连同 Android SDK 的其余部分)并且它在我的 PATH 变量中。请指教。
颤振医生:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.5, on macOS 11.1 20C69 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.1)
[✓] VS Code (version 1.52.1)
[☠] 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/akshat/AndroidSDK/platform-tools/adb
• #0 throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1 AndroidDevices.pollingGetDevices (package:flutter_tools/src/android/android_device_discovery.dart:71:7)
<asynchronous suspension>
#2 PollingDeviceDiscovery._populateDevices (package:flutter_tools/src/device.dart:467:60)
#3 PollingDeviceDiscovery.devices (package:flutter_tools/src/device.dart:457:12)
#4 DeviceManager.getAllConnectedDevices (package:flutter_tools/src/device.dart:171:20)
#5 DeviceValidator.validate (package:flutter_tools/src/doctor.dart:975:55)
#6 asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
#7 _rootRun (dart:async/zone.dart:1190:13)
#8 _CustomZone.run (dart:async/zone.dart:1093:19)
#9 _runZoned (dart:async/zone.dart:1630:10)
#10 runZonedGuarded (dart:async/zone.dart:1618:12)
#11 runZoned (dart:async/zone.dart:1547:12)
#12 asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
#13 Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:191:9)
#14 Doctor.diagnose (package:flutter_tools/src/doctor.dart:290:47)
#15 DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:59:47)
#16 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:977:18)
#17 _rootRunUnary (dart:async/zone.dart:1198:47)
#18 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#19 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#20 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#21 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#22 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#23 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#24 _rootRun (dart:async/zone.dart:1190:13)
#25 _CustomZone.run (dart:async/zone.dart:1093:19)
#26 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#27 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#28 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#29 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#30 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#31 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
! Doctor found issues in 2 categories.
包含 android 环境变量的 .zshrc 片段:
export PATH="${PATH}:/Users/akshat/flutter/bin/"
export ANDROID_SDK_ROOT="${ANDROID_SDK_ROOT}:/Users/akshat/AndroidSDK"
export ANDROID_HOME="/Users/akshat/AndroidSDK"
export PATH="${PATH}:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_HOME/tools"
adb --version 的输出
Android Debug Bridge version 1.0.41
Version 30.0.5-6877874
Installed as /Users/akshat/AndroidSDK/platform-tools/adb