gpt4 book ai didi

android - 运行 Android JUnit 测试时,LogCat 的 Log.x() 输出在哪里?

转载 作者:IT老高 更新时间:2023-10-28 23:11:06 27 4
gpt4 key购买 nike

我注意到,在通过 TestCase 派生的测试类测试纯 Java 类时和 AndroidTestCase , LogCat 输出消失。

是否仍然可以捕获这些消息的输出?或者我唯一的办法是使用更慢的ActivityInstrumentationTestCase2<>作为基类?

最佳答案

我有类似的问题...这里的重点是,在 Android Junit 模式下运行项目时,Eclipse 中可用的 logcat View 不显示任何内容。至少,在我使用的 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
.
.
.

关于android - 运行 Android JUnit 测试时,LogCat 的 Log.x() 输出在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5982468/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com