Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
# install dependencies
sudo apt-get install -yqq libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5
# download and unpack Android SDK
wget http://dl.google.com/android/android-sdk_r24.3.3-linux.tgz
mkdir /home/runner/android-sdk-linux
tar xf android-sdk_r24.3.3-linux.tgz -C /home/runner/
rm android-sdk_r24.3.3-linux.tgz
# install necessarry componenets
# 1 - Android SDK Tools, revision 24.3.3
# 2 - Android SDK Platform-tools, revision 22
# 5 - Android SDK Build-tools, revision 22.0.1
# 24 - SDK Platform Android 5.1.1, API 22, revision 2
# 67 - RM EABI v7a System Image, Android API 22, revision 1
echo y | /home/runner/android-sdk-linux/tools/android update sdk -u -a -t 1,2,5,24,67
sudo ln -fs /home/runner/android-sdk-linux/tools/emulator64-arm /usr/bin/android-emulator
# create virtual device
echo no | /home/runner/android-sdk-linux/tools/android create avd --force -n semaphore-android-dev -t android-22 --abi armeabi-v7a
# start the emulator in the background
android-emulator -avd semaphore-android-dev -no-skin -no-audio -no-window &
# block adb while the device is booting
/home/runner/android-sdk-linux/platform-tools/adb wait-for-device
# run a command through adb shell
echo ">>> Running emulator with Android version `/home/runner/android-sdk-linux/platform-tools/adb shell getprop ro.build.version.release`"
# setup environment
export ANDROID_HOME="/home/runner/android-sdk-linux"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"
export LD_LIBRARY_PATH=$ANDROID_HOME/tools/lib:$LD_LIBRARY_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment