Skip to content

Instantly share code, notes, and snippets.

@spilth
Last active November 14, 2022 17:44
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save spilth/e7385e7f5153f76cca40a192be35f4ba to your computer and use it in GitHub Desktop.
Save spilth/e7385e7f5153f76cca40a192be35f4ba to your computer and use it in GitHub Desktop.
Android Emulator with Homebrew
touch ~/.android/repositories.cfg
brew cask install caskroom/versions/java8
brew cask install android-sdk
brew cask install intel-haxm
brew install qt
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
sdkmanager "platform-tools" "platforms;android-27" "extras;intel;Hardware_Accelerated_Execution_Manager" "build-tools;27.0.0" "system-images;android-27;google_apis;x86" "emulator"
avdmanager create avd -n test -k "system-images;android-27;google_apis;x86"
/usr/local/share/android-sdk/tools/emulator -avd test
@spilth
Copy link
Author

spilth commented Oct 27, 2017

Installing QT might not even be necessary.

@lukaszczerpak
Copy link

avdmanager command returns "Error: Invalid --tag mytag for the selected package.", but adding "--tag google_apis" fixes it.

@chenqingspring
Copy link

"--tag google_apis" works!

@freewind
Copy link

freewind commented Aug 7, 2018

$/usr/local/share/android-sdk/tools/emulator -avd test
PANIC: Missing emulator engine program for 'x86' CPU.

Fix the emulator path to /usr/local/share/android-sdk/emulator/emulator if you are using new android sdks

@freewind
Copy link

freewind commented Aug 7, 2018

We may also need to run ./sdkmanager --update after installing brew cask install android-sdk, otherwise it will say your emulator is outdated.

@MPLew-is
Copy link

For anyone curious, installing QT is not necessary here as @spilth mentioned; omitting that line seems to not cause any negative effects when running the emulator.

@gamsim
Copy link

gamsim commented Mar 16, 2019

Yes for me I had to fix emulator path:

/usr/local/share/android-sdk/emulator/emulator -avd test

@virus2016
Copy link

Java 8 is no longer available due to Oracle licensing.

Use alternative JDK e.g. brew cask install homebrew/cask-versions/adoptopenjdk8

@robertoschwald
Copy link

To get updates for older java versions on brew cask upgrade, I recommend to enable the versions tap:

brew tap homebrew/cask-versions
brew install zulu8 # or adoptopenjdk8

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