Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- PACKAGE=$1
- if [ -z "$PACKAGE" ]; then
- echo "You must pass a .apk as input!"
- exit 1
- fi
- # Have the aapt in the PATH
- AAPT=`which aapt`
- if [ -z "$AAPT" ]; then
- # or export ANDROID_HOME=~/android/android-sdk
- AAPT=$ANDROID_HOME/build-tools/25.0.2/aapt
- fi
- PACKAGENAME=`$AAPT dump badging "$PACKAGE" | grep package:\ name | cut -d \' -f 2`
- echo "Package name = $PACKAGENAME"
- echo "Uninstalling $PACKAGENAME"
- adb uninstall $PACKAGENAME | sed -e 's/^/ /'
- sleep 1
- echo "Installing $PACKAGENAME"
- adb install "$PACKAGE" | sed -e 's/^/ /'
- echo "Launching $PACKAGENAME"
- adb shell monkey -p $PACKAGENAME -c android.intent.category.LAUNCHER 1
- sleep 1
- PID=`adb shell ps | grep $PACKAGENAME | awk '{ print $2 }'`
- echo PID=$PID
- adb logcat | grep $PID
Add Comment
Please, Sign In to add comment