Add SDK tools to path in Android Studio app

后端 未结 5 1458
时光说笑
时光说笑 2020-12-25 14:52

I have just installed Android Studio 0.2.2. I want to add the SDK tools to the $PATH, which are in this folder:

/Applications/Android\\ Studio.a         


        
5条回答
  •  悲哀的现实
    2020-12-25 15:23

    Put this in your ~/.profile:

    # Add the Android SDK tools to $PATH and set $ANDROID_HOME (standard)
    ANDROID_HOME="${HOME}/Library/Android/sdk"
    if [ -d "${ANDROID_HOME}" ]; then
      PATH="${PATH}:${ANDROID_HOME}/tools"
      PATH="${PATH}:${ANDROID_HOME}/platform-tools"
      ANDROID_BUILD_TOOLS_DIR="${ANDROID_HOME}/build-tools"
      PATH="${PATH}:${ANDROID_BUILD_TOOLS_DIR}/$(ls -1 ${ANDROID_BUILD_TOOLS_DIR} | sort -rn | head -1)"
    fi
    

    The build tools are unlike the others in that they're in subfolders. Eg there's build-tools/23.0.3, build-tools/25.0.1, build-tools/25.0.2... so this chooses the most recent one.

提交回复
热议问题