path app android,Add SDK tools to path in Android Studio app

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.app/sdk/tools

so that I can use them with e.g. Phonegap.

But after I add this folder to the $PATH, it still keeps saying:

android: command not found

Oddly, I can't run any of the executables in that folder even when I cd to that folder and type their names.

What am I doing wrong?

Nestor Turizo

It seems that newer versions of Android Studio don't come bundled with the SDK. So, /Applications/Android\ Studio.app/sdk/tools will no longer work.

After launching the SDK Manager from Android Studio, I realized the new path is

/Users/$USER/Library/Android/sdk/tools.

Steps

Open your ~/.bash_profile file by issuing the command open ~/.bash_profile on the terminal

Add the following lines to the end of that file

export PATH=/Users/$USER/Library/Android/sdk/tools:$PATH

export PATH=/Users/$USER/Library/Android/sdk/tools/bin:$PATH

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

Save and close the ~/.bash_profile file

If you want the changes to take action on the current terminal, then source ~/.bash_profile; otherwise, close and re-open the terminal, and the changes will take place automatically

You can add this folder to you PATH in .bash_profile (a hidden file in the home folder of the user):

export PATH=/Applications/Android\ Studio.app/sdk/tools:$PATH

and then reopen the terminal application.

If you need an environment for all your UI apps, you can use the .launchd.conf (or /etc/launchd.conf for all the users).

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.

You are getting bit by the escape character.

The reason tiziano's answer works for him is because the export command needs that backslash after "Android"

however, you are probably editing /etc/paths. When you put the path in there, you don't need the backslash, just put the lines:

/Applications/Android Studio.app/sdk/tools

/Applications/Android Studio.app/sdk/platform-tools

in /etc/paths, and you are good to go.

For me it was

~/Development/adt-bundle-mac-x86_64-20130729/sdk

来源:https://stackoverflow.com/questions/18143183/add-sdk-tools-to-path-in-android-studio-app

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值