简体   繁体   English

在 Mac OS X 上安装 Android SDK 的位置?

[英]Where to install Android SDK on Mac OS X?

在 Mac OS X 上 Android SDK 应该安装在哪里?

The easiest (and standard) way to install Android SDK under OS X is to use brew .在 OS X 下安装 Android SDK 的最简单(和标准)方法是使用brew

brew install android-sdk

If you do not have homebrew, here's how to get it .如果您没有自制软件,请按以下方法获取

This will install Android SDK into /usr/local/Cellar/android-sdk/ and, at this moment, this is the best location to install it.这会将 Android SDK 安装到/usr/local/Cellar/android-sdk/ ,此时,这是安装它的最佳位置。

In homebrew the android-sdk has migrated from homebrew/core to homebrew/cask .自制软件中android-sdk已经从homebrew/core迁移到homebrew/cask

brew tap homebrew/cask

and install android-sdk using并使用安装android-sdk

brew cask install android-sdk

You will have to add the ANDROID_HOME to profile (.zshrc or .bashrc)您必须将ANDROID_HOME添加到配置文件(.zshrc 或 .bashrc)

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

If you prefer otherwise, copy the package to如果您更喜欢其他方式,请将包复制到

~/opt/local/android-sdk-mac

When I installed Android Studio 1.0 it ended up in当我安装 Android Studio 1.0 时,它最终出现在

/Library/Android/sdk/ /图书馆/Android/SDK/

我个人的偏好是将它放在~/opt/local/android-sdk-mac或 / Developer/android-sdk-mac ,后者是 Xcode 和所有 Apple Dev 工具所在的位置。

默认情况下,android sdk 安装程序路径是~/Library/Android/sdk/

You can install android-sdk in different ways您可以通过不同的方式安装 android-sdk

  1. homebrew自制
    Install brew using command from brew.sh使用来自brew.sh 的命令安装 brew

     /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    Install android-sdk using安装android-sdk使用

    brew install android-sdk

    Now android-sdk will be installed in /usr/local/opt/android-sdk现在android-sdk将安装在/usr/local/opt/android-sdk

     export ANDROID_HOME=/usr/local/opt/android-sdk
  2. If you installed android studio following the website ,如果您按照网站安装了 android studio,
    android-sdk will be installed in ~/Library/Android/sdk android-sdk将安装在~/Library/Android/sdk

     export ANDROID_HOME=~/Library/Android/sdk

I think these defaults make sense and its better to stick to it我认为这些默认设置是有道理的,最好坚持下去

From http://developer.android.com/sdk/index.html , it seems that you can install the SDK anywhere, so long as youhttp://developer.android.com/sdk/index.html看来,你可以在任何地方安装 SDK,只要你

  1. "execute the android tool in the <sdk>/tools/ folder" “执行<sdk>/tools/文件夹中的android工具”
  2. Add the <sdk>/tools directory to your system path<sdk>/tools目录添加到您的系统路径

More info can be found here: http://developer.android.com/sdk/installing.html更多信息可以在这里找到: http : //developer.android.com/sdk/installing.html

I just have mine in MyUser/Documents/Development .我只有我的MyUser/Documents/Development I'm the only one that used my Mac, so I didn't need to worry about making it accessible system-wide.我是唯一一个使用我的 Mac 的人,所以我不需要担心让它在整个系统范围内都可以访问。

我把我的放在 /Developer/SDKs 中,我必须进行身份验证才能做到这一点……但由于没有达成共识,我认为这听起来像是我记得的地方。

I ended up placing my at ~/sdks/android-sdk-mac_x86.我最终将我的放在 ~/sdks/android-sdk-mac_x86。 I like to keep all of my SDKs in one place and for me an sdk folder under my home directory makes the most sense.我喜欢把我所有的 SDK 放在一个地方,对我来说,我的主目录下的 sdk 文件夹最有意义。

I have been toying with this as well.我也一直在玩这个。 I initially had it in my documents folder, but decided that didn't make 'philosophical' sense.我最初将它放在我的文档文件夹中,但认为这没有“哲学”意义。 I decided to create an Android directory in my home folder and place Eclipse and the Android SKK in there.我决定在我的主文件夹中创建一个 Android 目录,并将 Eclipse 和 Android SKK 放在那里。

brew install android-sdk --cask 

A simple way is changing to required sdk in some android project the number of一个简单的方法是在一些android项目中更改为所需的sdk数量

compileSdkVersion编译SDK版本

in build.gradle file and you can install with the manager在 build.gradle 文件中,您可以使用管理器进行安装

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM