我在 root 的 Android 设备上运行一个 shell 脚本,我试图通过跟踪 shell 脚本生成的标准输出输出(通过命令或回显)来调试它。是否可以通过将 stdout 重定向到 logcat 来做到这一点?
最佳答案
在您的 Android Shell 脚本中,使用以下命令:
log -p v -t "test" "test script message"
然后您将在 Androids Logcat 中看到您的消息:
adb logcat | grep test
用法:
log [-p priorityChar] [-t tag] message
priorityChar should be one of:
v,d,i,w,e
这适用于 Droid 4.4.3
关于android - 如何从 root 设备中的 shell 脚本将 stdout 重定向到 logcat?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17336639/