Logcat不显示我的日志调用 [英] Logcat not displaying my log calls

查看:138
本文介绍了Logcat不显示我的日志调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android编程的总编辑,想学习如何调试我的应用程序。我似乎没有在LogCat中显示我的Log.i | d | v调用。

I'm a total noob at Android programming, and wanted to learn how to debug my apps. I can't seem to have my Log.i|d|v calls displayed in the LogCat.

这是我正在使用的代码。正如你所看到的,我已经定义了一个LOG_TAG常量,但似乎没有在LogCat中找到它。我也输入了android.util.Log,我已经确保在我的AndroidManifest我有可调试设置为TRUE。

Here's the code that I'm using. As you can see I have defined a LOG_TAG constant, but can't seem to find it in the LogCat. I have also imported android.util.Log AND I have made sure that in my AndroidManifest I have "debuggable" set to TRUE.

我还检查了 http://developer.android.com/reference/android/util/Log.html 没有任何运气解决这个问题。

I have also checked http://developer.android.com/reference/android/util/Log.html w/o any luck resolving this issue.

我做错了什么?我甚至在正确的地方看吗?我试过使用DDMS和Debug透视图,没有任何运气。对这个noob的任何帮助将不胜感激。谢谢。

What am I doing wrong? Am I even looking in the right place? I've tried using the DDMS and Debug perspective as well w/o any luck. Any help to this noob would be greatly appreciated. Thanks.

我的环境:
Windows XP
IDE = Eclipse版本:3.6.1,Build ID:M20100909-0800
模拟器=有它指向android sdk 2.1 api 7

My environment: Windows XP IDE = Eclipse Version: 3.6.1, Build id: M20100909-0800 Emulator = having it point to android sdk 2.1 api 7

//非常基本的HELLO世界代码与几个Log.i调用

//very basic HELLO World code with a couple of Log.i calls

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class debugger extends Activity {
    private static final String LOG_TAG = "debugger";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        Log.i(LOG_TAG, "line 13");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Log.i(LOG_TAG, "CREATING NOW");
    }
}


推荐答案

使用Eclipse,在DDMS透视图中,确保选择并突出显示正确的设备(可以是emulator-xxxx)。只有这样,您才能在logcat视图中获取logcat输出。

When using Eclipse, in the DDMS perspective, make sure the correct device (propably emulator-xxxx) is selected and highlighted. Only then will you get the logcat output in the logcat view.

此外,Android插件有点奇怪,有时只显示logcat视图中的最后一行。如果发生这种情况,请尝试清除日志。之后,您应该再次收到所有的日志条目(无论如何也适用于我)。

Also, the Android plugin is a bit quircky, and sometimes only shows the last line in the logcat view. If this happens, try to clear the log. After that, you should get all the log entries again (works for me anyway).

这篇关于Logcat不显示我的日志调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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