Skip to content

Instantly share code, notes, and snippets.

@tiiime
Created December 17, 2020 04:12
Show Gist options
  • Save tiiime/d705ae0403a0baaff7a4c78b4020bfa6 to your computer and use it in GitHub Desktop.
Save tiiime/d705ae0403a0baaff7a4c78b4020bfa6 to your computer and use it in GitHub Desktop.
get current running app log
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-c)
adb logcat -c
shift
;;
*)
esac
shift
done
CURRENT_APP=$(adb shell dumpsys activity recents | grep 'Recent #0' | cut -d= -f2 | sed 's| .*||' | cut -d '/' -f1)
echo $CURRENT_APP
adb logcat $1 --pid=$(adb shell pidof -s $CURRENT_APP) | lnav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment