Error: ANDROID_HOME is not set and “android” comma

2018-12-31 23:34发布

I'm trying to install PhoneGap and I'm getting the following error:

Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

Error (screenshot)

enter image description here

What do I do to ensure Android is set up correctly for use with Cordova?

18条回答
其实,你不懂
2楼-- · 2019-01-01 00:05

1: go to system properties
2: click change setting
3: click advance tab
4: click Environment Variables... button
5: in system variables area click new button
6: set ANDROID_HOME in the Variable name field
7: set C:\Program Files (x86)\Android\android-sdk in the Variable value field
9: click ok button
10: double click Path variable in the list
11: click new button
12: past C:\Program Files (x86)\Android\android-sdk\platform-tools in the filed
13: click new button again
14: past C:\Program Files (x86)\Android\android-sdk\tools in the field
15: press enter 3 times.
your are good to go.

查看更多
爱死公子算了
3楼-- · 2019-01-01 00:06

For Windows:

set ANDROID_HOME=C:\ installation location \android-sdk

set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Taken from this installation guide.

查看更多
梦该遗忘
4楼-- · 2019-01-01 00:07

Using Android Studio on Windows the system variables settings have changed a little.

You still have to add a system variable ANDROID_HOME, but pointing to the directory containing the android SDK usually installed in C:\Users\YOUR_USERNAME\AppData\Local\Android\android-studio\sdk.

You also need to add the following to the Path system variable:

;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;

Taken from: https://github.com/simnova/webdevdocs/wiki/Installing-PhoneGap-and-Android-Studio-on-Windows

SDK Path also be in C:\Users\USER\AppData\Local\Android\sdk

查看更多
忆尘夕之涩
5楼-- · 2019-01-01 00:08

For Windows I just had to add an env variable pointing to the SDK folder. Done! (The accepted answer didn´t work for me)

enter image description here

查看更多
旧时光的记忆
6楼-- · 2019-01-01 00:11

Using Android Studio on Mac, run this on your terminal:

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

Then, when you type

android

at your terminal, it will run something

查看更多
荒废的爱情
7楼-- · 2019-01-01 00:11

In Linux,

edit .bashrc file and add the ANDROID_HOME and PATH variable,

export ANDROID_HOME=/usr/local/android-sdk-linux/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools

After saving .bashrc file, run

source ~/.bashrc

then in type

android in a terminal

if it will run, ANDROID_HOME and PATH is set,

if you get this message,

bash: /src/android-sdk/tools/android: Permission denied

then run

sudo chmod a+x /usr/local/android-sdk-linux/tools/android

otherwise you will get same error message

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.

NB: Use your android sdk installation path instead of /usr/local/android-sdk-linux/

查看更多
登录 后发表回答