我跑
cordova run android
并收到此消息:
ANDROID_HOME=C:\Users\myusername\AppData\Local\Android\sdk\
JAVA_HOME=C:\Program Files\java\jdk1.8.0_121
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: C:\Users\myusername\AppData\Local\Android\sdk\tools\templates\gradle\wrapper
我将SDK工具从此link降级到版本25.2.3 (只需解压缩到Android sdk文件夹以替换现有的工具文件夹)我没有问题(对25.2.x的可选更新也没有问题)。
答案 0 :(得分:4)
I also found that, from Android SDK 25.3.0 and up, the android
command itself (under sdk/tools/
) became obsolete. The command now simply goes like this:
#!/bin/bash
echo The "android" command is no longer available.
echo For manual SDK and AVD management, please use Android Studio.
echo For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
exit 1
while the current cordova relies on the existence of Android SDK by executing android list target
command (in cordova/lib/android_sdk_version.js
for example). So I guess we would better wait until the upstream fix (so that it uses avdmanager list target --compact
instead) is done, or manually downgrade the SDK to 25.2.5 temporary.
EDIT: just forgot to mention that mine is on macOS, while I see yours on Windows... but there could be something to do with it.