Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CedricGuillemet/8b58d6e1bf4de833fda3853acd49b862 to your computer and use it in GitHub Desktop.
Save CedricGuillemet/8b58d6e1bf4de833fda3853acd49b862 to your computer and use it in GitHub Desktop.
Azure run android Emulator
# useful commands
# list already installed Android packages : $ANDROID_HOME/tools/bin/sdkmanager --list
# stop activity : adb shell am force-stop com.android.babylonnative.playground
# test activity is running : adb shell pidof com.android.babylonnative.playground
#$ANDROID_HOME/platform-tools/adb devices
# adb shell pm grant com.android.babylonnative.playground android.permission.CAMERA
# rotate screen
# adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
# adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
- bash: |
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-27;google_apis;x86'
displayName: 'Install Android image'
- script: |
$ANDROID_HOME/emulator/emulator -list-avds
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n test_android_emulator -k 'system-images;android-27;google_apis;x86' --force
$ANDROID_HOME/emulator/emulator -list-avds
displayName: 'Create AVD'
- script: |
nohup $ANDROID_HOME/emulator/emulator -avd test_android_emulator -no-snapshot -skin 600x400 > /dev/null 2>&1 & $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
displayName: 'Start Android emulator'
- script: |
cd Apps/Playground/Android
adb install -t -g app/build/outputs/apk/debug/app-debug.apk
adb shell am start -n com.android.babylonnative.playground/com.android.babylonnative.playground.PlaygroundActivity
sleep 15
adb logcat -t 5000
mkdir Captures
adb exec-out screencap -p > Captures/screen.png
displayName: 'Install and run APK'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment