使用Logcat和Emulator进行Android调试。可能吗? [英] Android Debugging with Logcat and Emulator. Is it possible?
问题描述
这很简单:我在Android上使用NetBeans Android模拟器1.6。我的Android手机上有Logcat,但是将消息传递到某处可读的过程根本就不顺利。
This is pretty simple: I'm using NetBeans on Linux with Android emulator 1.6. I have Logcat on my android phone, but the process of getting the messages to somewhere readable isn't smooth at all.
有人可以告诉我如何让Logcat运行模拟器?有什么我可以做的,看看调试信息,然后不得不复制apk到我的手机和测试吗?
Can someone tell me how to get Logcat running on the emulator? Is there anything I can do to see debug messages other then having to copy the apk to my phone and testing it?
提前感谢!
推荐答案
$ b
You have a few options for viewing the debug log output, assuming you have the SDK installed and your command path set up correctly:
-
键入
adb logcat
。将显示连接设备或运行仿真器的日志输出。我通常喜欢adb logcat -v time
来查看时间戳。
Type
adb logcat
. The log output from the connected device or running emulator will appear. I usually preferadb logcat -v time
to see the time stamps.
键入 ddms
。这将启动DDMS的独立版本。它的底部有一个logcat显示。
Type ddms
. This launches the stand-alone version of DDMS. It has a logcat display at the bottom.
安装Eclipse的ADT扩展,打开logcat视图。 (由于您使用的是NetBeans,我认为这不是你想要做的,但我提到它是为了完整。)
Install the ADT extension for Eclipse, and open the logcat view. (Since you're using NetBeans I assume this isn't what you want to do, but I'm mentioning it for completeness.)
在所有情况下,无论您使用物理设备还是软件仿真器,互动都是一样的,因为ADB守护程序会隐藏详细信息。无论您正在为设备做什么,预计也可以用于仿真器。
In all cases, the interaction is the same whether you're using a physical device or software emulator, because the ADB daemon conceals the details. Whatever you're doing for the device is also expected to work for the emulator.
如果您的设备和仿真器同时连接,您可以使用 adb -e logcat
为模拟器和 adb -d logcat
为设备。从独立的DDMS或Eclipse,只需从弹出菜单中选择设备或模拟器。
If you have a device and emulator connected simultaneously, you can use adb -e logcat
for the emulator and adb -d logcat
for the device. From stand-alone DDMS or Eclipse, just pick the device or emulator from the pop-up menu.
这篇关于使用Logcat和Emulator进行Android调试。可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!