Skip to content

Instantly share code, notes, and snippets.

@ylogx
Last active March 2, 2020 20:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ylogx/31c127901c4b63e96e1d to your computer and use it in GitHub Desktop.
Save ylogx/31c127901c4b63e96e1d to your computer and use it in GitHub Desktop.
Build Script for doing Android Studio 'run' equivalent from command line
#!/usr/bin/env bash
PACKAGE=com.example.demo
ACTIVITY=.MainActivity
APK_LOCATION=app/build/outputs/apk/app-debug.apk
echo "Package: $PACKAGE"
echo "Building the project with tasks: $TASKS"
./gradlew $TASKS
echo "Uninstalling $PACKAGE"
adb uninstall $PACKAGE
echo "Installing $APK_LOCATION"
adb install $APK_LOCATION
echo "Starting $ACTIVITY"
adb shell am start -n $PACKAGE/$ACTIVITY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment