Skip to content

Instantly share code, notes, and snippets.

@kiwenlau
Forked from Erichain/installAndroidSDKOnMac.md
Last active August 1, 2017 06:41
Show Gist options
  • Save kiwenlau/8e1978796e84dcfd4694bdae583dc202 to your computer and use it in GitHub Desktop.
Save kiwenlau/8e1978796e84dcfd4694bdae583dc202 to your computer and use it in GitHub Desktop.
Mac OS下安装和配置android-sdk

MAC OS下安装和配置android-sdk

安装

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

brew update
brew cask install android-sdk

配置

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

vim .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就可以启动模拟器了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment