Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mac OS下安装和配置android-sdk

##MAC OS下安装和配置android-sdk

###安装

在MAC上安装android-sdk,标准的安装方法是使用homebrew,运行如下命令:

brew update

brew install android-sdk

如果遇到无法通过代理下载安装包的情况时,可以先手动下载安装包, 然后,将安装包放到homebrew的缓存里,

$ cp <path to download file> $(brew --cache android-sdk)

再执行

$ brew install android-sdk

这样,就可以成功安装android-sdk了。


###配置

1、配置.bash_profile,如果使用的是Oh-My-Zsh,则配置.zshrc,在文件的结尾加上下面这句:

export ANDROID_HOME="/usr/local/opt/android-sdk"

然后source ~/.zshrc使其生效

2、安装辅助包

运行android命令,调出Android SDK Manager,安装下面这些选项:

  • Tools

    • Android SDK Tools
    • Android SDK Platform-tools
    • Android SDK Build-tools
  • Android 5.1.1 (API 22)

    • SDK Platform
    • Intel x86 Atom_64 System Image
  • Extras

    • Android Suport Library
    • Intel x86 Emulator Accelerator(HAXM Installer)

3、安装HAXM(Hardware_Accelerated_Execution_Manager)

进入以下目录

$ cd /usr/local/Cellar/android-sdk/24.4.1_1/extras/intel/Hardware_Accelerated_Execution_Manager/

然后安装HAXM

$ ./HAXM\ installation

就这样,android模拟器就安装好了。


###配置模拟器

运行以下命令:

$ android avd

  • 打开Android Virtual Device Manager

  • 选择Device Definitions一项

  • 选择需要的模拟器类型,点击Create AVD

创建完成AVD之后,回到Android Virtual Devices选项卡,选择创建好的模拟器,点击Start就可以启动模拟器了。

@EXSVAMP

This comment has been minimized.

Copy link

@EXSVAMP EXSVAMP commented Jun 19, 2017

brew 命令 修改为 brew cask install android-sdk

@chunlintang

This comment has been minimized.

Copy link

@chunlintang chunlintang commented Mar 8, 2019

brew 命令 修改为 brew cask install android-sdk

然后.bash_prodile就要改成export ANDROID_HOME=/usr/local/share/android-sdk

@garasmc

This comment has been minimized.

Copy link

@garasmc garasmc commented Dec 21, 2019

android 无法启动 Android SDK Manager 的 GUI 进行安装的

可使用 tools/bin/sdkmanager --list 列出所有可用包,用命令行手动安装

@Frankxsh

This comment has been minimized.

Copy link

@Frankxsh Frankxsh commented Apr 23, 2020

我用brew cask install android-sdk 安装完毕之后,./zsh里面会自动添加Android_Home。用Finder在对应的路径下也能找到,但是Android_studio识别不出来!所以,我只能用brew cask uninstall android-sdk卸载后,用Android Studio下载一边,下载到/Users/用户名/Library/Android/sdk 这个目录里面(用户名是你本机的用户名,例如lisa)

@youngjuning

This comment has been minimized.

Copy link

@youngjuning youngjuning commented Nov 3, 2020

说 android studio 太大的,电脑是有多小啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.