Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bojanpotocnik/880ff24f7738562d3434bc44f9a56e27 to your computer and use it in GitHub Desktop.
Save bojanpotocnik/880ff24f7738562d3434bc44f9a56e27 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
PACKAGE_NAME=com.my.package
# Block until the PACKAGE_NAME starts and print its PID
adb_wait_pid() { adb shell "until pidof $PACKAGE_NAME; do :; done"; }
# Wait for the app to start and show all its output
adb logcat -v color -v printable --pid $(adb_wait_pid)
# Wait for the app to start and log to file
adb logcat -v printable --pid $(adb_wait_pid) > "logcat_$PACKAGE_NAME_$(date +'%Y%m%d%H%M%S').log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment