Skip to content

Instantly share code, notes, and snippets.

@rosdyana
Last active December 18, 2018 10:33
Show Gist options
  • Save rosdyana/da17c6a58447fae757585c7d54caeded to your computer and use it in GitHub Desktop.
Save rosdyana/da17c6a58447fae757585c7d54caeded to your computer and use it in GitHub Desktop.
[ANDROID] Build & Install CLI
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
# ANDROID PART #
alias launchEmulator="$ANDROID_HOME/emulator/emulator -avd Nexus_5_API_27"
alias aapt="$ANDROID_HOME/build-tools/28.0.3/aapt"
## install apk to device
alias apkinstall="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X install -r $1"
## build and install apk
alias buildAndInstallApk="./gradlew assembleDebug && apkinstall ./app/build/outputs/apk/debug/app-debug.apk"
## launch apk
alias launchDebugApk="adb shell monkey -p \`aapt dump badging ./app/build/outputs/apk/debug/app-debug.apk | grep -e 'package: name' | cut -d \' -f 2\` 1"
## build+install+launch apk
alias buildInstallLaunchDebugApk="buildAndInstallApk && launchDebugApk"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment