科尔多瓦:找不到Android SDK.确保已安装.如果它不在默认位置,请设置ANDROID_HOME环境变量 [英] Cordova: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable
问题描述
我在用Cordova构建android时遇到问题,当我执行cordova build android
时,我收到此错误:
I am having problem to build android with Cordova, when I execute cordova build android
, I receive this error:
Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
我已通过修复此问题:
sudo nano ~/.bash_profile
并添加以下行:
export PATH=${PATH}:/Users/myname/Library/Android/sdk/platform-tools:/Users/myname/Library/Android/sdk/tools
然后这个:
source ~/.bash_profile
但是在构建时再次遇到该错误,该如何解决?
but I get again that error when I build, how can I fix it?
更新:
这是我在bash中添加的行:
This is the line I Added in the bash:
export PATH=${PATH}:/Users/myname/Library/Android/sdk/platform-tools:/Users/myname/Library/Android/sdk/tools
export ANDROID_HOME=/Users/myname/Library/Android/sdk
推荐答案
最近的 Android SDK工具删除了android
命令.
$ android -v
The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
cordova
是该更改的背后因素,似乎有人正在对此进行改进: https://issues.apache.org/jira/browse/CB-12554
cordova
is behind the change and someone seems to be working on it: https://issues.apache.org/jira/browse/CB-12554
您还可以将工具降级到仍可以使用android
的版本.
You can also downgrade your tools to a version where the android
was still available.
尽管如此,我还是找到了一种运行Android应用程序的方法,而不必降级我的SDK工具.我将(1)运行cordova prepare
,然后(2)从Android Studio运行我需要的命令.就我而言,在模拟器上运行就足够了.
Nevertheless, I found a way to run the Android app without having to downgrade my SDK tools. I would (1) run cordova prepare
, then (2) run the command I need from Android Studio. In my case, running it on the emulator was enough.
更新:问题 CB-12554 已解决,并与cordova-android@6.2.0
版本.
UPDATE: The issue CB-12554 is resolved now and was released with the cordova-android@6.2.0
release.
更新:已经完成了多个相关的后续修补程序,而最新的版本是cordova-android@6.2.3
.运行cordova platform rm android; cordova platform add android@6.2.3
修复问题.
UPDATE: There were several related subsequent patches done and the newest version is cordova-android@6.2.3
. Run cordova platform rm android; cordova platform add android@6.2.3
to fix the issues.
这篇关于科尔多瓦:找不到Android SDK.确保已安装.如果它不在默认位置,请设置ANDROID_HOME环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!