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

前端 未结 22 796
闹比i
闹比i 2020-11-22 16:16

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. Yo

相关标签:
22条回答
  • 2020-11-22 16:25

    On Linux, add this to the end of your .bashrc, .profile or appropriate file for your shell:

    export ANDROID_HOME=/home/youruser/whatever/adt-bundle-linux-x86_64-20140702/sdk
    export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools
    

    Please notice that these environment variables will be available for newly created shells, not the already open.

    0 讨论(0)
  • 2020-11-22 16:25

    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

    0 讨论(0)
  • 2020-11-22 16:30

    ANDROID_HOME is deprecated now instead of using ANDROID_HOME use ANDROID_SDK_ROOT

    as per Google android documentation -

    ANDROID_SDK_ROOT sets the path to the SDK installation directory. Once set, the value does not typically change, and can be shared by multiple users on the same machine. ANDROID_HOME, which also points to the SDK installation directory, is deprecated.

    If you continue to use it, the following rules apply:

    • If ANDROID_HOME is defined and contains a valid SDK installation, its value is used instead of the value in ANDROID_SDK_ROOT.
    • If ANDROID_HOME is not defined, the value in ANDROID_SDK_ROOT is used.
    • If ANDROID_HOME is defined but does not exist or does not contain a valid SDK installation, the value in ANDROID_SDK_ROOT is used instead.

    For details follow this Android Documentation link

    0 讨论(0)
  • 2020-11-22 16:35
    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
    
    0 讨论(0)
  • 2020-11-22 16:36

    By the way, one other possibility is that you do have a too old version of cordova android platform.

    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.

    Then:

    cordova platform update android --save
    
    0 讨论(0)
  • 2020-11-22 16:39

    if Linux users still have the same error, probably they have used "sudo" for adding android platform.. a quick solution for this here, or you have installed cordova using sudo, also there is a solution for this problem here.

    Hope this help!

    0 讨论(0)
提交回复
热议问题