9

When using the adb Monitor tool to read the Logcat, I like to filter out all everything but what directly affects the app. Trouble is, it's really hard to tell what the PID of your app. It easy enough if the app using Unity, but if it doesn't, It's almost impossible to use to tell.

So is there a ADB command that can tell what PID an app used?

Branderson20
  • 191
  • 1
  • 1
  • 2

2 Answers2

10

Simply do:

adb.exe shell pidof com.packagename.example

If you want to ensure only one PID is shown try:

adb.exe shell pidof -s com.packagename.example
Yahya Uddin
  • 201
  • 2
  • 3
9

You should be able to run a shell command from adb:

adb shell ps | grep your.app.name

And that will return details about your process. The second number will be the PID of your app. This is if grep is installed. If grep isn't installed, you can just run ps and it will dump all processes to your screen.

You can dump logcat to a file to retroactively look at processes (up to a point)
logcat > /sdcard/logcatDump.txt

However, logcat data is stored in memory so it will all be lost after a reboot.

D. Gibbs
  • 451
  • 3
  • 7