homebrew 在哪里安装 android-sdk?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26209083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:07:03  来源:igfitidea点击:

Where does homebrew install android-sdk?

androidmacoshomebrew

提问by hopper

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

运行命令时 homebrew 在哪里安装 android-sdk:

brew cask install android-sdk

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

我希望能够将它添加到 PATH。

采纳答案by Rodrigo Ayala

The installation folder of android-sdkis:

的安装文件夹android-sdk是:

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

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

因此,如果要将其添加到 PATH,则需要在 ~/.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-sdkfolder to see what version you have installed.

不要忘记<VERSION>用已安装的版本替换,只需查看android-sdk文件夹内部即可查看已安装的版本。

回答by lfender6445

use brew cask info android-sdk

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

在 2017 年 3 月之前,您可以运行 brew info android-sdk

回答by Endareth

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

不幸的是,brew 现在已经更改了 android-sdk 的安装位置,因此所有这些旧问题都不再正确。

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-sdkto 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).

当通过 安装时brew cask install android-sdk,您现在会被告知您应该添加export ANDROID_SDK_ROOT=/usr/local/share/android-sdk到您的配置文件中,并且实际上,该目录现在是版本 android-sdk 目录(当前为/usr/local/Caskroom/android-sdk/25.2.3)的符号链接。

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

总而言之,将以下内容添加到您的 .profile/.bashrc/.whatever 中:

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

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

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

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

回答by olimortimer

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

您最好使用 Homebrew 创建到 ANDROID_HOME 的符号链接,因为它始终是最新版本:

/usr/local/opt/android-sdk/

/usr/local/opt/android-sdk/

So your PATH would be:

所以你的 PATH 将是:

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

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

回答by kite

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

在我的机器中,在 /usr/local/share/android-sdk

回答by Travis

Homebrew installs things in the Cellar:

Homebrew 在 Cellar 中安装东西:

/usr/local/Cellar

/usr/local/Cellar