Skip to content

Instantly share code, notes, and snippets.

@Davenchy
Last active April 12, 2019 17:19
Show Gist options
  • Save Davenchy/bcb0a423d05bfcfe591d7a3609c635bd to your computer and use it in GitHub Desktop.
Save Davenchy/bcb0a423d05bfcfe591d7a3609c635bd to your computer and use it in GitHub Desktop.
build and run the android app using cordova and adb
# 1. replace the variables values
# 2. add the script in the root directory of your cordova project
# Notes:
# make sure that cordova installed globaly
# make sure that adb is installed
# variables
PACKAGENAME='me.davenchy.myapp'
ACTIVITYNAME='MainActivity'
echo ">>>>>>>>>> starting the install script <<<<<<<<<<"
echo ">> Package Name: $PACKAGENAME"
echo ">> Activity Name: $ACTIVITYNAME"
echo ">>>>>>>>>> build the app <<<<<<<<<<"
# build using cordova
cordova build android
echo ">>>>>>>>>> uninstall the old app <<<<<<<<<<"
# uninstall the package from device
cd ./platforms/android/app/build/outputs/apk/debug/
adb uninstall $PACKAGENAME
echo ">>>>>>>>>> install the new app <<<<<<<<<<"
# install the new package
adb install app-debug.apk
echo ">>>>>>>>>> starting the app <<<<<<<<<<"
# start the activity
adb shell am start -n $PACKAGENAME/$PACKAGENAME.$ACTIVITYNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment