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

后端 未结 7 1249
予麋鹿
予麋鹿 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:04

    If you have root access or the device is running without SELinux enabled, then you can follow the way from Android site:

    Set up the device so that you can run strace. You need to be root, disable SELinux, and restart the runtime to remove the seccomp filter that will otherwise prevent strace from running: adb root adb shell setenforce 0 adb shell stop adb shell start

    Set up a world-writable directory for strace logs, because strace will be running under the app's uid: adb shell mkdir -m 777 /data/local/tmp/strace

    Choose the process to trace and launch it: adb shell setprop wrap.com.android.calendar '"logwrapper strace -f -o /data/local/tmp/strace/strace.com.android.calendar.txt"'

    Launch the process normally.

    https://source.android.com/devices/tech/debug/strace#app-strace

提交回复
热议问题