我试图安装PhoneGap,我得到以下错误:

错误:ANDROID_HOME没有设置,“android”命令不在你的路径中。你必须至少满足其中一个条件。

错误(截图)

我怎么做才能确保Android正确设置为使用Cordova?


当前回答

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.

这就是你所需要做的。

其他回答

对于Mac OS X:

export ANDROID_HOME=/<installation location>/android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

我不得不关闭并重新打开我的windows控制台(或打开一个新的控制台),然后打开SDK管理器(运行android),之后必须完成一系列更新和安装。

在Mac上使用Android Studio,在你的终端上运行这个:

export ANDROID_HOME=/Applications/Android\ Studio.app/sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools

然后,当你打字的时候

android

在您的终端上,它将运行一些内容

如果其他方法都不起作用,请确保在构建过程中设置了正确的权限和所有权。快速解决方法可以是:

sudo chown -R <you>:<your_group> *
sudo chmod -R 755 *

Windows:

    set ANDROID_HOME=C:\ *installation location* \android-sdk
    
    set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

摘自本安装指南。