uTu*_*Fan 20 junit android logcat android-logcat
我注意到,当通过从TestCase和派生的测试类测试普通Java类时AndroidTestCase,LogCat输出消失了.
是否仍然可以捕获这些消息的输出?或者我唯一的办法是使用更加缓慢ActivityInstrumentationTestCase2<>的基础类?
bru*_*aga 19
我有类似的问题......这里的重点是Eclipse中可用的logcat视图在Android Junit模式下运行项目时没有显示任何内容.至少,在我使用的Android 2.1中,这就是行为.
您可以通过从命令行(终端窗口)检查logcat来解决此问题:
# check the device name you are using
# It gives something like this:
$ ./adb devices
List of devices attached
emulator-5554 device
# open logcat of the device
$ ./adb -s emulator-5554 logcat
D/AndroidRuntime( 943):
D/AndroidRuntime( 943): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 943): CheckJNI is ON
.
.
.
Run Code Online (Sandbox Code Playgroud)
这两个语句都产生logcat登录:
android.util.Log.d(TAG, "This is Log.d");
System.out.println("This is System.out.println");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14720 次 |
| 最近记录: |