Skip to content

Instantly share code, notes, and snippets.

@ginkgomzd
Created August 25, 2017 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ginkgomzd/11d872bd39a20ada778c9f30b3054f28 to your computer and use it in GitHub Desktop.
Save ginkgomzd/11d872bd39a20ada778c9f30b3054f28 to your computer and use it in GitHub Desktop.
#
# Invoke from cordova project root
# Locates the apk, detects the package name, uninstalls it before installing.
# Starts the app using `adb shell am...`
#
adbinst() {
apk=`find . -name android-debug.apk`
platforms=`find . -maxdepth 1 -type d -name platforms`
if [ "$platforms" != './platforms' ] ; then echo "NOT IN PROJECT DIR"; return; fi
package=`awk 'match($0, /package="([^"]*)/, matches) { print matches[1] }' <./platforms/android/AndroidManifest.xml`;
echo "uninstall " $package
adb $1 uninstall $package
echo "install apk" $apk
adb $1 install $apk
#start the app
adb shell am start -n $package/.MainActivity
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment