问题描述
Android.我用过:
Android. I used:
import android.util.*;
......
Log.d("MyActivity", "Debug output");
但这不会在控制台中显示任何内容.我还可以使用什么呢?
but this not show anything in console. What else may I use?
推荐答案
System.out.println("Debug output");
[修改]
我在SO上找到了这一点,它在一个解决方案中表示,将Android System.out和System.err中的重定向到/dev/null,有效地将所有输出发送到了必杀技.请阅读有关SO的详细信息:是否可以在Android应用程序中打印到控制台? [ ^ ]
还有一个很有希望的链接会将您发送到此网站: http://developer.android.com/tools/help/adb.html#logcat [^ ]
[最终修改]
问候,
[Modification]
I found this bit on SO where it says in one solution that in android System.out and System.err are redirected to /dev/null, effectively sending all your output into nirvana. Please read the details on SO: Is there a way to print to the console in an Android app?[^]
There is also an promising link sending you to this site: http://developer.android.com/tools/help/adb.html#logcat[^]
[End Modificiation]
Regards,
这篇关于如何编写控制台消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!