先决条件
- 已正确安装Android SDK(目录:/Users/gamecube/Library/Android/sdk)
如何重现:
- 运行以下命令:
cordova build android
- 运行以下命令以启动Android模拟器:
cordova emulate android --verbose
预期结果
模拟器将被启动。
实际结果
Command finished with error code 0: /Users/gamecube/Desktop/geocars/platforms/android/gradlew cdvBuildDebug,-b,/Users/gamecube/Desktop/geocars/platforms/android/build.gradle
Built the following apk(s):
/Users/gamecube/Desktop/geocars/platforms/android/app/build/outputs/apk/debug/app-debug.apk
No scripts found for hook "before_deploy".
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/gamecube/Library/Android/sdk (DEPRECATED)
Running command: adb devices
Command finished with error code 0: adb devices
Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
CordovaError: Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
at /Users/gamecube/Desktop/geocars/platforms/android/cordova/lib/emulator.js:176:35
at processTicksAndRejections (internal/process/task_queues.js:97:5)
我的问题
为什么Android模拟器不工作?
和
为什么会出现这个错误?:
CordovaError: Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?