-bash: android: command not found on Mac OSX

前端 未结 9 1835
陌清茗
陌清茗 2020-12-12 13:38

I\'ve been diving into Android development for a while, and now I want to use some project (helpshift) in my app. On the website they have some example apps in which the rea

相关标签:
9条回答
  • 2020-12-12 14:18

    Problem Solved For Android Studio Users:

    I am using Mac OS X Elcapitan version 10.11.X.

    Under my home directory I found .bash_profile.save file. I opened that file using sublime (you can use any other editor). Then I added this line

    export PATH=${PATH}:/Users/UserName/Library/Android/sdk/platform-tools:/Users/UserName/Library/Android/sdk/tools
    

    Replace "UserName" with your UserName.

    open terminal then run

     source ~/.bash_profile 
    

    here you go.

    0 讨论(0)
  • 2020-12-12 14:19

    Add the following lines into ~/.bash_profile and source ~/.bash_profile

    export ANDROID_HOME=/Users/macbook/Library/Android/sdk/
    export PATH=$ANDROID_HOME/tools:$PATH
    export PATH=$ANDROID_HOME/platform-tools:$PATH
    

    This is working for me

    0 讨论(0)
  • 2020-12-12 14:24

    First add these lines to your ~/.bashrc file:

    export ANDROID_HOME=${HOME}/Library/Android/sdk
    export PATH=${PATH}:${ANDROID_HOME}/tools
    export PATH=${PATH}:${ANDROID_HOME}/platform-tools
    

    then:

    source ~/.bashrc
    
    0 讨论(0)
  • 2020-12-12 14:25

    I spent so much time trying to figure out, this steps helped me ( from http://docs.phonegap.com/en/2.2.0/guide_getting-started_android_index.md.html ) You need to execute your .bash_profile to update your PATH.

    Set up your PATH environment variable on Mac OS

    Open the Terminal program (this is in your Applications/Utilites folder by default). Run the following command

    touch ~/.bash_profile; open ~/.bash_profile

    This will open the file in the your default text editor. You need to add the path to your Android SDK platform-tools and tools directory. In my example I will use "/Development/android-sdk-macosx" as the directory the SDK is installed in. Add the following line:

    export PATH=${PATH}:/Development/android-sdk-macosx/platform-tools:/Development/android-sdk-macosx/tools

    Save the file and quit the text editor. Execute your .bash_profile to update your PATH:

    source ~/.bash_profile

    Now every time you open the Terminal program you PATH will included the Android SDK.

    0 讨论(0)
  • 2020-12-12 14:27

    Step 0

    The first step is install Android SDK: https://developer.android.com/studio

    I don't like the default configurations. I installed SDK in this folder:

    /Users/<Username>/Android\ SDK
    

    ℹ️ The default path is

    $HOME/Library/Android/sdk
    

    Step 1

    The next command open your bash or zshrc configuration file:

    Bash profile:

    vim ~/.bash_profile
    

    If you use zsh:

    vim ~/.zshrc
    

    Step 2

    You're ready to update your configurations:

    # File: .bash_profile | .zshrc
    
    # Custom path to Android SDK folder. 
    # If you use the default configuration please change ANDROID_HOME to $HOME/Library/Android/sdk
    export ANDROID_HOME=/Users/<Username>/Android\ SDK
    export PATH=$ANDROID_HOME/tools:$PATH
    export PATH=$ANDROID_HOME/platform-tools:$PATH
    

    Step 3

    Option 1: Restart your terminal and you should be able to use android command

    Option 2: source your bash or zsh profile.

    Example: source ~/.bash_profile / source ~/.zshrc

    0 讨论(0)
  • 2020-12-12 14:28

    This is the issue because of you didn't give proper android sdk path variable in .bash_profile. for this you must follow the below steps.
    1. Check android sdk path: for this you should open android studio->preferences and click on Android SDK in newly open window in that look for Android SDK location textfield in that you can find path of Android SDK. For me it shows like: /Users/<your_name>/Library/Android/sdk. here <your_name> is name of your home directory.
    2. Open your terminal enter cd ~ command.
    3. and enter vi .bash_profile.
    4. In vi editor enter following
    export ANDROID_HOME=/Users/Murali/Library/Android/sdk export PATH=$ANDROID_HOME/tools:$PATH export PATH=$ANDROID_HOME/platform-tools:$PATH
    Save it by press esc button and enter :wq.
    5. After this close your terminal and open it again. 6. To apply all your changes in .bash_profile enter following command
    source .bash_profile.
    7. Enter android command. Hope this now working fine :-)

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