我试图安装PhoneGap,我得到以下错误:
错误:ANDROID_HOME没有设置,“android”命令不在你的路径中。你必须至少满足其中一个条件。
错误(截图)
我怎么做才能确保Android正确设置为使用Cordova?
我试图安装PhoneGap,我得到以下错误:
错误:ANDROID_HOME没有设置,“android”命令不在你的路径中。你必须至少满足其中一个条件。
错误(截图)
我怎么做才能确保Android正确设置为使用Cordova?
当前回答
如果Linux用户仍然有同样的错误,可能他们已经使用了“sudo”添加android平台。这里有一个快速的解决方案,或者您已经使用sudo安装了cordova,这里也有一个解决这个问题的解决方案。
希望这对你有所帮助!
其他回答
在Windows上使用Android Studio,系统变量设置发生了一些变化。
你仍然需要添加一个系统变量ANDROID_HOME,但是指向包含android SDK的目录,通常安装在C:\Users\YOUR_USERNAME\AppData\Local\ android \android-studio\ SDK。
您还需要向Path系统变量添加以下内容:
% ANDROID_HOME % \平台工具;% ANDROID_HOME % \工具;
摘自:https://github.com/simnova/webdevdocs/wiki/Installing-PhoneGap-and-Android-Studio-on-Windows
SDK路径也在C:\Users\USER\AppData\Local\Android\sdk
这就是我想要的。我在:
os x Yosemite版本10.10.2 Cordova 4.2.0版 Android studio 1.0.1 Java SE开发工具包7
设置路径:
# on ~/.zshrc file (open a text editor)
export ANDROID_HOME="/Users/<user>/Library/Android/sdk/"
export ANDROID_TOOLS="/Users/<user>/Library/Android/sdk/tools"
export ANDROID_PLATFORM_TOOLS="/Users/<user>/Library/Android/sdk/platform-tools"
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
打开终端
从android SDK管理器安装“android-19”
$ android
# pick "SDK Platform Android 4.4.2, API 19"
然后进入一个基于cordova的项目目录
$ ionic platform add android
Go to system properties. Click change setting. Click advance tab. Click Environment Variables button. In system variables area click new button. Set ANDROID_HOME in the Variable name field. Set C:\Program Files (x86)\Android\android-sdk in the Variable value field. Click ok button. Double click Path variable in the list. Click new button. Past C:\Program Files (x86)\Android\android-sdk\platform-tools in the filed. Click new button again. Past C:\Program Files (x86)\Android\android-sdk\tools in the field. Press enter 3 times.
这就是你所需要做的。
对于Windows,我只需要添加一个指向SDK文件夹的env变量。完成了! (公认的答案对我不起作用)
如果Linux用户仍然有同样的错误,可能他们已经使用了“sudo”添加android平台。这里有一个快速的解决方案,或者您已经使用sudo安装了cordova,这里也有一个解决这个问题的解决方案。
希望这对你有所帮助!