Created
February 8, 2018 18:17
-
-
Save sauceaaron/4dcca5b4955a7bc824e34cb6df53ab34 to your computer and use it in GitHub Desktop.
Install Android SDK and create an Emulator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ### install Android SDK tools | |
| echo "installing Android SDK tools" | |
| ### prepare Android SDK install location | |
| ANDROID_HOME=Android/sdk | |
| ANDROID_SDK_ROOT=$ANDROID_HOME/ | |
| mkdir -p $ANDROID_SDK_ROOT | |
| cd $ANDROID_SDK_ROOT | |
| ### Download Android SDK tools | |
| ANDROID_SDK_TOOLS_LINK=https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip | |
| wget $ANDROID_SDK_TOOLS_LINK | |
| ### Unzip Android SDK tools | |
| ANDROID_SDK_TOOLS_ZIP=sdk-tools-darwin-3859397.zip | |
| unzip $ANDROID_SDK_TOOLS_ZIP | |
| ### install dependencies | |
| SDKMANAGER=$ANDROID_SDK_ROOT/tools/bin/sdkmanager | |
| $SDKMANAGER --sdk_root=$ANDROID_SDK_ROOT "build-tools;27.0.3" | |
| $SDKMANAGER --sdk_root=$ANDROID_SDK_ROOT "emulator" | |
| $SDKMANAGER --sdk_root=$ANDROID_SDK_ROOT "platform-tools" | |
| ### Install emulators | |
| $SDKMANAGER --sdk_root=$ANDROID_SDK_ROOT "platforms;android-26" | |
| $SDKMANAGER --sdk_root=$ANDROID_SDK_ROOT "sources;android-26s" | |
| $SDKMANAGER --sdk_root=$ANDROID_SDK_ROOT "system-images;android-26;google_apis;x86" | |
| ### create AVD | |
| AVDMANAGER=$ANDROID_SDK_ROOT/tools/bin/avdmanager | |
| DEVICE_NAME="Pixel-Android-26" | |
| $AVDMANAGER create avd --name "$DEVICE_NAME" --package "system-images;android-26;google_apis;x86" --tag "google_apis" --force --device "pixel" | |
| ### start emulator | |
| EMULATOR=/tmp/Android/sdk/tools/emulator | |
| $EMULATOR -list-avds | |
| $EMULATOR -avd $DEVICE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!
One little issue, the emulated device doesn't have a play store preinstalled, any idea?