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

查看:44
本文介绍了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 中我将debuggable"设置为 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 透视图,但运气不佳.对这个菜鸟的任何帮助将不胜感激.谢谢.

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.

我的环境:视窗 XPIDE = Eclipse 版本:3.6.1,构建 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 World 代码,带有几个 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天全站免登陆