Set ANDROID_HOME environment variable in mac

后端 未结 17 809
梦谈多话
梦谈多话 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 08:08

    If you try to run "adb devices" OR any other command and it says something like

    zsh: command not found adb
    

    It tells that you are using zsh shell and /.bash_profile won't work as it should. You will have to execute bash_profile everytime with source ~/.bash_profile command when you open terminal, and it isn't permanent.

    To fix this run

    nano ~/.zshrc

    Terminal image

    and then paste following commands at the end of the file

    export ANDROID_HOME=/Users/{YourName}/Library/Android/sdk
    export PATH=$ANDROID_HOME/platform-tools:$PATH
    export PATH=$ANDROID_HOME/tools:$PATH
    export PATH=$ANDROID_HOME/tools/bin:$PATH
    

    NOTE: You can find Android Home url from Android Studio > Preferences System Settings > Android SDK > Android SDK Location textbox

    To save it, hit Ctrl + X, type Y to save and then enter to keep the file name as it is.

    Restart the terminal and try your commands again.

提交回复
热议问题