Android: How to strace an app using ADB shell am start
adb, android, runtime, shell, strace
Solution
Android apps are actually started by forking the zygote process, so you can trace app initialization by tracing the zygote process and following child processes ('-f'):
setenforce 0 # In Android 4.3 and later, if SELinux is enabled, strace will fail with "strace: wait: Permission denied"
set `ps | grep zygote` ; strace -p $2 -f -tt -T -s 500 -o /sdcard/strace.txt
Problem
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 to emulator. I am able to install an APK using the ADB install filename.apk I am able to run the app using the ADB shell `am start -a android.intent.action.Main -n com.akproduction.notepad/com.akproduction.notepad.NoteList` I try to strace using (ADB shell) `strace am start -a android.intent.action.Main -n com.akproduction.notepad/com.akproduction.notepad.NoteList` but I get nothing! How do you trace the runtime behavior of Android apps and their installation? (P.S. The test app is located here.