如何读取不同应用程序的日志?

How to read the logs of a different app?

我的应用程序 A 可以与 Playstore 上已有的应用程序 B 一起使用。 两个应用程序读取和写入同一个数据库,但应用程序 B 在应用程序 A 想要一起工作时不断出现问题,只显示消息:

Unfortunately application B has stopped

我无法访问应用程序的 B 源代码,但我需要查看发生了什么。

是否可以读取应用程序 B 上的日志?

我有 2 台 android 设备,一台是 android-6.0-marshmallow,另一台是 android-8.0-oreo。

您可以使用 ADB 查看 root phone 上的日志。

This page 对如何做到这一点有相当完整的描述。

短版。 运行 使用 adb shell 命令在设备上 shell 然后使用可用的有限的 linux 命令集进行导航。