1

I have a rooted install of Android on my phone and a terminal emulator. I can run su and then commands like ps and top, however they only show me things like com.android.deskclock for running apps, rather than a full path to an executable. Is there a way for me to get the full path for these running apps?

  • Apps on Android doesn't have a Native-Program-ish full path, an installed app is roughly a directory containing its Java classes (possibly with some AOT compiled code) – 炸鱼薯条德里克 Aug 7 at 0:29
  • It might be better if you show your results of ps or top in the question – 炸鱼薯条德里克 Aug 7 at 0:30
3

You can get the full path of the executable just like on any Linux system with:

readlink /proc/PID/exe

However, for all the android apps, that's just /system/bin/app_process32 or /system/bin/app_process64 ie the same executable as the main/zygote process (itself started by init).

That process will just fork children process which will then load the java classes making up an Android app, without exec()ing any extra binary.

The command lines you see in the output of ps (/proc/PID/cmdline) are just "faked" as usual by overwriting the argv block -- see here.

  • OK, so is there a way I can find out which actual Java files Android is using for a particular app's process? – Jez Aug 7 at 12:01
  • Use pm list packages -f to list both names and files of each app, IIRC. I'm not able to check just now. – mosvy Aug 7 at 12:02
  • That seems to work. Thanks. – Jez Aug 7 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.