Where does homebrew install android-sdk?

2019-03-18 02:44发布

Where does homebrew install the android-sdk when you run the command:

brew cask install android-sdk

I want to be able to add it to the PATH.

6条回答
ら.Afraid
2楼-- · 2019-03-18 03:06

use brew cask info android-sdk

after installing, you can get some basic information about what needs to be set and where:

› brew cask info android-sdk
...etc
/usr/local/Caskroom/android-sdk/3859397,26.0.1/build-tools/26.0.1/aapt (binary)
/usr/local/Caskroom/android-sdk/3859397,26.0.1/tools/bin/avdmanager
...etc

==> Caveats
We will install android-sdk-tools, platform-tools, and build-tools for 
you. You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:

  'export ANDROID_SDK_ROOT=/usr/local/share/android-sdk'

notes

Prior to March 2017 you could run brew info android-sdk

查看更多
ら.Afraid
3楼-- · 2019-03-18 03:13

in my machine, at /usr/local/share/android-sdk

查看更多
Deceive 欺骗
4楼-- · 2019-03-18 03:14

The installation folder of android-sdk is:

/usr/local/Cellar/android-sdk/<VERSION>

Therefore, if you want to add it to PATH, you need to add the following line to ~/.bashrc

export PATH=$PATH:/usr/local/Cellar/android-sdk/<VERSION>/tools:/usr/local/Cellar/android-sdk/<VERSION>/platform-tools

Don't forget to replace <VERSION> with an installed version, just take a look inside of android-sdk folder to see what version you have installed.

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-03-18 03:17

Homebrew installs things in the Cellar:

/usr/local/Cellar

查看更多
三岁会撩人
6楼-- · 2019-03-18 03:32

Unfortunately, brew has now changed where android-sdk is installed, so all of these older questions are no longer correct.

When installing via brew cask install android-sdk, you'll now be informed that you should add export ANDROID_SDK_ROOT=/usr/local/share/android-sdk to your profile, and, indeed, that directory is now a symlink to the version android-sdk directory (currently /usr/local/Caskroom/android-sdk/25.2.3).

To summarise, add the following to your .profile/.bashrc/.whatever:

export ANDROID_SDK_ROOT=/usr/local/share/android-sdk

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

查看更多
我只想做你的唯一
7楼-- · 2019-03-18 03:33

You would be better off using the symlink that Homebrew creates to ANDROID_HOME, as it will always be the newest version:

/usr/local/opt/android-sdk/

So your PATH would be:

export PATH=$PATH:/usr/local/opt/android-sdk/tools:/usr/local/opt/android-sdk/platform-tools

查看更多
登录 后发表回答