Set ANDROID_HOME environment variable in mac

后端 未结 17 798
梦谈多话
梦谈多话 2020-12-04 07:36

I am new in developing native app using Salesforce SDK. I tried to create android project from command line using forcedroid tool but there is problem in setting environment

相关标签:
17条回答
  • 2020-12-04 07:57

    Open the terminal and type :

    export ANDROID_HOME=/Applications/ADT/sdk
    

    Add this to the PATH environment variable

    export PATH=$PATH:$ANDROID_HOME/platform-tools
    

    If the terminal doesn't locate the added path(s) from the .bash_profile, please run this command

    source ~/.bash_profile

    Hope it works to you!

    0 讨论(0)
  • 2020-12-04 07:58

    If you are setting up the ANDROID_HOME environment on MacOS Catalina , .bash_profile is no longer apple's default shell and it won't persist your path variables. Use .zprofile instead and follow the environment setup instructions in react-native documentation or others. .bash_profile will keep creating new file which won't make the path permanent or persist on closing the terminal on your system path.

    Modified as it's providing answer to the frustration of setting up android_home environment on MacOS.

    0 讨论(0)
  • 2020-12-04 08:00

    Based on Abraham Mayowa Oluwasina answer provided above is the correct one. MacOS Catalina, .bash_profile is no longer apple's default shell and it won't persist your path variables instead use .zprofile instead.

    In root directory,

    touch .zprofile
    open -e .zprofile
    

    Add the following in file,

    export ANDROID_HOME=/Users/<username>/Library/Android/sdk
    export PATH=$PATH:$ANDROID_HOME/platform-tools
    

    Save and exit

    To activate

    source ~/. zprofile
    

    echo $ANDROID_HOME

    0 讨论(0)
  • 2020-12-04 08:01

    As a noob I was struggling a lot with setting up the variable.I was creating copies of .bash_profile files, the text in file was not saving etc ..

    0 讨论(0)
  • 2020-12-04 08:01

    MacOS

    add this string in file ~/.bashrc or ~/.zshrc

    export ANDROID_HOME="/Users/<userlogin>/Library/Android/sdk"
    
    0 讨论(0)
  • 2020-12-04 08:02

    try with this after add ANDROID_HOME on your Environment Variable, work well on my mac

    flutter config --android-sdk ANDROID_HOME

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