This guide will help you set up and build the Android Emulator on your Mac for development.
Download: Get Xcode from the App Store.
Install: Open the downloaded file, move Xcode to your “Applications” folder.
Accept License & Install Tools:
sudo xcodebuild -license accept && sudo xcode-select --install
Verify Installation:
xcodebuild -version
Install Repo:
mkdir $HOME/bin curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > $HOME/bin/repo chmod 700 $HOME/bin/repo export PATH=$PATH:$HOME/bin
Add export PATH=$PATH:$HOME/bin
to your .bashrc
or .zshrc
file.
Initialize Repo:
mkdir -p $HOME/emu-master-dev && cd $HOME/emu-master-dev repo init -u https://android.googlesource.com/platform/manifest -b emu-master-dev
Download Code:
repo sync -j 8
Build:
cd external/qemu && android/rebuild.sh
List Available Virtual Devices:
./objs/emulator -list-avds
Incremental Builds:
export PATH=$PATH:$HOME/emu-master-dev/prebuilts/ninja/darwin-x86/ ninja -C objs
Configuring the build:
You can get additional information on how to configure the build by running:
android/rebuild.sh --help
For example ./android/rebuild.sh --task CTest
will run all the unit tests
Running unit tests:
We use ctest
to run unit tests. You can run them in the objs
directory
cd objs; ctest -j 10
You can obtain the latest build of the emulator from our build servers. Look for the sdk-repo-{architecture}-emulator-{buildid}.zip
artifact.
You might need to remove a quarantine flag before running them:
xattr -dr com.apple.quarantine /path/to/my/unzipped/emulator
Here you can find details on submitting patches.