Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save csantanapr/f2acab418bb757e5d6a2 to your computer and use it in GitHub Desktop.
Save csantanapr/f2acab418bb757e5d6a2 to your computer and use it in GitHub Desktop.
Simple bash script to remove, build, install and launch your ionic app on all connected android devices (android simulators or actual devices).
#!/bin/sh
#Your app id which can be found in your config.xml file (widget id)
app=com.ionicframework.myNewApp
pathToAPK=platforms/android/build/outputs/apk/android-debug.apk
echo "Running Ionic Build"
ionic build
echo "Started to loop over the connected android devices"
for SERIAL in $(adb devices | grep -v List | cut -f 1);
do
echo "**** Uninstalling the app from the phone ****"
adb -s $SERIAL shell pm uninstall $app
echo "***** Clearing any local data stored with this app on the phone *****"
adb -s $SERIAL shell pm clear $app
echo "***** Installing the app on the phone *****"
adb -s $SERIAL install -r platforms/android/build/outputs/apk/android-debug.apk
echo "***** Launching the app on the phone *****"
adb -s $SERIAL shell monkey -p $app -c android.intent.category.LAUNCHER 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment