Skip to content

Instantly share code, notes, and snippets.

@reidbaker
Last active August 29, 2015 13:56
Show Gist options
  • Save reidbaker/9255040 to your computer and use it in GitHub Desktop.
Save reidbaker/9255040 to your computer and use it in GitHub Desktop.
##Launch default activity in apk##
# Commands are surrounded in triple quotes '''
#'''adb shell am start -n <package name>/<activity name>''' will start activity
#'''`<command here>`''' will evaluate command in back ticks
#'''aapt dump badging <your apk file>.apk''' will print a bunch of things including the package and default activity
#'''grep -o "package.*[\.][a-zA-Z]*[\']\|launchable-activity.*[\.][a-zA-Z]*[\']"''' will match either the package or activity
#'''| grep -o "['][a-zA-Z\.].*[']"''' then strip out everything but what we want surrounded by quotes
#'''sed "s/'//g"''' strip quotes
#'''sed -n -e ":a" -e "$ s/\n/\//gp;N;b a"''' replace newline with forward slash
adb shell am start -n `aapt dump badging <your apk file>.apk | grep -o "package.*[\.][a-zA-Z]*[\']\|launchable-activity.*[\.][a-zA-Z]*[\']" | grep -o "['][a-zA-Z\.].*[']" | sed "s/'//g" | sed -n -e ":a" -e "$ s/\n/\//gp;N;b a"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment