Android: How to strace an app using ADB shell am start

后端 未结 7 1235
予麋鹿
予麋鹿 2020-12-13 11:37

I need help on stracing Android apps in the SDK emulator.

Here is my setup:

I have an Android SDK emulator running the Android API 4.03 ADB shell connected t

相关标签:
7条回答
  • 2020-12-13 12:10

    The "am start" command does not directly run your application; it simply tells Android to do whatever is necessary to, in your example, start a specific activity.

    The strace command is normally used as in strace commandname command args and it launches commandname -- easy, but in this Android use case, not helpful. However, strace has a -p option which is helpful to you: strace -p <process id> will let you start tracing the process with the specified id.

    If you type ps on your Android system you can locate the process with the name com.akproduction.notepad (probably; by default processes are named for their Android package, but it's possible to change that in the manifest). Then you can start stracing it, wherever it happens to be.

    If you need to catch things early in the process, you'll need to either modify the code to cause it to delay until you're ready to trace it, or you'll at least need to get the process running before you start the activity. The second option there is often as easy as starting the activity, then using the back button, then getting your trace ready, then starting the activity again -- but this is always code-specific to the application.

    0 讨论(0)
提交回复
热议问题