我试图安装PhoneGap,我得到以下错误:
错误:ANDROID_HOME没有设置,“android”命令不在你的路径中。你必须至少满足其中一个条件。
错误(截图)
我怎么做才能确保Android正确设置为使用Cordova?
我试图安装PhoneGap,我得到以下错误:
错误:ANDROID_HOME没有设置,“android”命令不在你的路径中。你必须至少满足其中一个条件。
错误(截图)
我怎么做才能确保Android正确设置为使用Cordova?
当前回答
如果Linux用户仍然有同样的错误,可能他们已经使用了“sudo”添加android平台。这里有一个快速的解决方案,或者您已经使用sudo安装了cordova,这里也有一个解决这个问题的解决方案。
希望这对你有所帮助!
其他回答
顺便说一下,另一种可能是你有一个太旧版本的cordova android平台。
错误:Android SDK未找到。确保已安装。如果它不在默认位置,则设置ANDROID_HOME环境变量。
然后:
cordova platform update android --save
在Linux中,
编辑.bashrc文件,添加ANDROID_HOME和PATH变量,
export ANDROID_HOME=/usr/local/android-sdk-linux/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
保存“。bashrc”文件后,运行
source ~/.bashrc
然后是字体
终端Android
如果它将运行,ANDROID_HOME和PATH设置,
如果你收到这条消息
bash: /src/android-sdk/tools/android: Permission denied
然后运行
sudo chmod a+x /usr/local/android-sdk-linux/tools/android
否则,您将得到相同的错误消息
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.
注意:使用您的android sdk安装路径,而不是/usr/local/android-sdk-linux/
只需要一个改变就可以解决这个问题:
执行“开始->控制面板->系统->高级(tab) ->环境变量->系统变量”
设置ANDROID_HOME为C:\Program Files (x86)\Android\ android-sdk
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.
这就是你所需要做的。
Android path set in linux:
$export ANDROID_HOME=/usr/lib/android-sdk-linux
$export PATH=$PATH:$ANDROID_HOME/tools
$export PATH=$PATH:$ANDROID_HOME/platforms-tools
than
$cordova run android