View the Log on device

2019-04-10 05:07发布

I want to view the Log on device i.e the System.out.println(). I am able to view on DDMS but how to view on device screen while running an APK file.

3条回答
啃猪蹄的小仙女
2楼-- · 2019-04-10 05:42

Provided you have root on your phone you can use the logcat utility in the Terminal application:

# logcat
D/dalvikvm(  142): GC freed 200 objects / 8744 bytes in 254ms
etc..

It displays the same log (/dev/log/main) as the adb logcat command that was suggested in another answer.

查看更多
爷的心禁止访问
3楼-- · 2019-04-10 05:45

There is also a Logcat app available for android.

code.google.com/p/android-random/downloads/list

查看更多
混吃等死
4楼-- · 2019-04-10 06:03

Run 'adb logcat' on the command line of your PC would also work. You want to see the log output on the device's screen though? Hmm, why? I don't believe you can call up a shell or access the logs from an application, unless your device is rooted.

What you can do, of course, is create a TextView in your app, and update its contents with whatever message you like.

查看更多
登录 后发表回答