使用 Logcat 和模拟器进行 Android 调试.是否可以? [英] Android Debugging with Logcat and Emulator. Is it possible?

查看:48
本文介绍了使用 Logcat 和模拟器进行 Android 调试.是否可以?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很简单:我在 Linux 上使用 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?

提前致谢!

推荐答案

假设您安装了 SDK 并且正确设置了命令路径,您有几个选项可以查看调试日志输出:

You have a few options for viewing the debug log output, assuming you have the SDK installed and your command path set up correctly:

  1. 输入adb logcat.将出现连接设备或正在运行的模拟器的日志输出.我通常更喜欢 adb logcat -v time 来查看时间戳.

  1. Type adb logcat. The log output from the connected device or running emulator will appear. I usually prefer adb 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 和模拟器进行 Android 调试.是否可以?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆