android - 日志猫。如何追踪错误?

标签 android eclipse debugging

我是 Android 调试新手。我阅读了关于 logCat 和 DDMS 的功能和过滤功能。

但是,我不明白如何使用 logCat 调试我的代码。我按错误对我的 logcat 进行了分类。我收到了 30 个与各种问题相关的错误,从声音问题到电池问题再到主要问题......

04-20 06:31:09.982: ERROR/Zygote(33): setreuid() failed. errno: 2
04-20 06:31:16.872: ERROR/Zygote(33): setreuid() failed. errno: 17
04-20 06:31:18.064: ERROR/BatteryService(60): usbOnlinePath not found
04-20 06:31:18.064: ERROR/BatteryService(60): batteryVoltagePath not found
04-20 06:31:18.064: ERROR/BatteryService(60): batteryTemperaturePath not found
04-20 06:31:18.082: ERROR/SurfaceFlinger(60): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
04-20 06:31:23.482: ERROR/EventHub(60): could not get driver version for /dev/input/mouse0, Not a typewriter
04-20 06:31:23.482: ERROR/EventHub(60): could not get driver version for /dev/input/mice, Not a typewriter
04-20 06:31:23.692: ERROR/System(60): Failure starting core service
04-20 06:31:23.692: ERROR/System(60): java.lang.SecurityException
04-20 06:31:23.692: ERROR/System(60):     at android.os.BinderProxy.transact(Native Method)
04-20 06:31:23.692: ERROR/System(60):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
04-20 06:31:23.692: ERROR/System(60):     at android.os.ServiceManager.addService(ServiceManager.java:72)
04-20 06:31:23.692: ERROR/System(60):     at com.android.server.ServerThread.run(SystemServer.java:184)
04-20 06:31:24.602: ERROR/SoundPool(60): error loading /system/media/audio/ui/Effect_Tick.ogg
04-20 06:31:24.602: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressStandard.ogg
04-20 06:31:24.602: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressSpacebar.ogg
04-20 06:31:24.612: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressDelete.ogg
04-20 06:31:24.622: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressReturn.ogg
04-20 06:31:26.411: ERROR/ThrottleService(60): Could not open GPS configuration file /etc/gps.conf
04-20 06:31:27.751: ERROR/logwrapper(149): executing /system/bin/tc failed: No such file or directory
04-20 06:31:27.792: ERROR/logwrapper(150): executing /system/bin/tc failed: No such file or directory
04-20 06:31:27.823: ERROR/logwrapper(151): executing /system/bin/tc failed: No such file or directory
04-20 06:31:37.841: ERROR/HierarchicalStateMachine(60): TetherMaster - unhandledMessage: msg.what=3
04-20 06:31:58.767: ERROR/AndroidRuntime(277): FATAL EXCEPTION: main
04-20 06:31:58.767: ERROR/AndroidRuntime(277): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.markana.yamba/com.markana.yamba.StatusActivity1}: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1 in loader dalvik.system.PathClassLoader[/data/app/com.markana.yamba-2.apk]
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.os.Looper.loop(Looper.java:123)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at java.lang.reflect.Method.invokeNative(Native Method)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at java.lang.reflect.Method.invoke(Method.java:521)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at dalvik.system.NativeStart.main(Native Method)
04-20 06:31:58.767: ERROR/AndroidRuntime(277): Caused by: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1 in loader dalvik.system.PathClassLoader[/data/app/com.markana.yamba-2.apk]
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-20 06:31:58.767: ERROR/AndroidRuntime(277):     ... 11 more
04-20 07:30:54.993: ERROR/Zygote(33): setreuid() failed. errno: 2
04-20 07:31:02.125: ERROR/Zygote(33): setreuid() failed. errno: 17
04-20 07:31:03.243: ERROR/BatteryService(59): usbOnlinePath not found
04-20 07:31:03.243: ERROR/BatteryService(59): batteryVoltagePath not found
04-20 07:31:03.243: ERROR/BatteryService(59): batteryTemperaturePath not found
04-20 07:31:03.273: ERROR/SurfaceFlinger(59): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
04-20 07:31:09.004: ERROR/EventHub(59): could not get driver version for /dev/input/mouse0, Not a typewriter
04-20 07:31:09.004: ERROR/EventHub(59): could not get driver version for /dev/input/mice, Not a typewriter
04-20 07:31:09.265: ERROR/System(59): Failure starting core service
04-20 07:31:09.265: ERROR/System(59): java.lang.SecurityException
04-20 07:31:09.265: ERROR/System(59):     at android.os.BinderProxy.transact(Native Method)
04-20 07:31:09.265: ERROR/System(59):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
04-20 07:31:09.265: ERROR/System(59):     at android.os.ServiceManager.addService(ServiceManager.java:72)
04-20 07:31:09.265: ERROR/System(59):     at com.android.server.ServerThread.run(SystemServer.java:184)
04-20 07:31:10.843: ERROR/SoundPool(59): error loading /system/media/audio/ui/Effect_Tick.ogg
04-20 07:31:10.865: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressStandard.ogg
04-20 07:31:10.865: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressSpacebar.ogg
04-20 07:31:10.873: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressDelete.ogg
04-20 07:31:10.884: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressReturn.ogg
04-20 07:31:12.824: ERROR/ThrottleService(59): Could not open GPS configuration file /etc/gps.conf
04-20 07:31:14.294: ERROR/logwrapper(149): executing /system/bin/tc failed: No such file or directory
04-20 07:31:14.364: ERROR/logwrapper(150): executing /system/bin/tc failed: No such file or directory
04-20 07:31:14.403: ERROR/logwrapper(152): executing /system/bin/tc failed: No such file or directory
04-20 07:31:26.859: ERROR/HierarchicalStateMachine(59): TetherMaster - unhandledMessage: msg.what=3
04-20 07:31:49.188: ERROR/AndroidRuntime(298): FATAL EXCEPTION: main
04-20 07:31:49.188: ERROR/AndroidRuntime(298): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.markana.yamba/com.markana.yamba.StatusActivity1}: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1 in loader dalvik.system.PathClassLoader[/data/app/com.markana.yamba-1.apk]
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.os.Looper.loop(Looper.java:123)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at java.lang.reflect.Method.invokeNative(Native Method)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at java.lang.reflect.Method.invoke(Method.java:521)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at dalvik.system.NativeStart.main(Native Method)
04-20 07:31:49.188: ERROR/AndroidRuntime(298): Caused by: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1 in loader dalvik.system.PathClassLoader[/data/app/com.markana.yamba-1.apk]
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-20 07:31:49.188: ERROR/AndroidRuntime(298):     ... 11 more
04-20 07:33:45.057: ERROR/AndroidRuntime(369): FATAL EXCEPTION: main
04-20 07:33:45.057: ERROR/AndroidRuntime(369): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.markana.yamba/com.markana.yamba.StatusActivity1}: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1 in loader dalvik.system.PathClassLoader[/data/app/com.markana.yamba-1.apk]
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.os.Looper.loop(Looper.java:123)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at java.lang.reflect.Method.invokeNative(Native Method)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at java.lang.reflect.Method.invoke(Method.java:521)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at dalvik.system.NativeStart.main(Native Method)
04-20 07:33:45.057: ERROR/AndroidRuntime(369): Caused by: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1 in loader dalvik.system.PathClassLoader[/data/app/com.markana.yamba-1.apk]
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-20 07:33:45.057: ERROR/AndroidRuntime(369):     ... 11 more
04-20 07:33:58.677: ERROR/AndroidRuntime(412): FATAL EXCEPTION: main
04-20 07:33:58.677: ERROR/AndroidRuntime(412): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.markana.yamba/com.markana.yamba.StatusActivity1}: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1 in loader dalvik.system.PathClassLoader[/data/app/com.markana.yamba-2.apk]
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.os.Looper.loop(Looper.java:123)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at java.lang.reflect.Method.invokeNative(Native Method)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at java.lang.reflect.Method.invoke(Method.java:521)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at dalvik.system.NativeStart.main(Native Method)
04-20 07:33:58.677: ERROR/AndroidRuntime(412): Caused by: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1 in loader dalvik.system.PathClassLoader[/data/app/com.markana.yamba-2.apk]
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-20 07:33:58.677: ERROR/AndroidRuntime(412):     ... 11 more

我在类里面的代码非常简单,我按照 Android Orielly 书中的示例做了:

package com.markana.yamba;

import winterwell.jtwitter.Twitter;
import winterwell.jtwitter.TwitterException;
import android.app.Activity;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class StatusActivity2 extends Activity implements OnClickListener{
    private static final String TAG= "StatusActivity";
    EditText editText;
    Button updateButton;
    TextView textCount;
    Twitter twitter;


    /** Called when the activity is first created. */
    @SuppressWarnings("deprecation")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.status);
        //Finds views
        editText =(EditText) findViewById(R.id.editText);
        updateButton=(Button) findViewById(R.id.buttonUpdate);
        updateButton.setOnClickListener(this);


        textCount= (TextView) findViewById(R.id.editText);
        textCount.setText(Integer.toString(40));
        textCount.setTextColor(Color.GREEN);
   //     editText.addTextChangedListener(this);

        twitter=new Twitter("student","password");
        twitter.setAPIRootUrl(("http://yamba.marakana.com/api"));   
        //added by me
        AsyncTask<String, ?, ?> asyn=new PostToTwitter();
        asyn.execute("deliver this to twitter");
    }



    class PostToTwitter extends AsyncTask<String,Integer, String>
    {
        @Override
        protected String doInBackground(String... statuses) {

            try{
            Twitter.Status status=twitter.updateStatus(statuses[0]);
            return status.text;
            }
            catch(TwitterException e)
            {
                Log.e(TAG,e.toString());
                e.printStackTrace();
                return "Failed to post";
            }
        }

        protected void onProgressUpdate(Integer...values)
        {
               super.onProgressUpdate(values);
        }

        protected void onPostExecute(String result)
        {
            Toast.makeText(StatusActivity2.this,result,Toast.LENGTH_LONG).show();           
        }
    }




    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        String status=editText.getText().toString();
        new PostToTwitter().execute(status);
        Log.d(TAG, "onClick");
    }
}

我没有红色错误标记,这里也没有,main.xml 和 string.xml 文件中也没有

我如何跟踪我的错误?

最佳答案

您只需通读输出即可找到

Caused by: java.lang.ClassNotFoundException: com.markana.yamba.StatusActivity1

这意味着您已部署到设备的 .apk 中缺少此类。

请注意,您的 Activity 名为 StatusActivity2 - 仔细检查 list 是否仍有 StatusActivity1

关于android - 日志猫。如何追踪错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5727055/

相关文章:

android - Eclipse ADT 插件版本 16.0.0,它在哪里?

android - 无法更改 fragment SupportMapFragment 的容器 ID

android - 使用 Facebook SDK 3.0 登录 facebook

java - 使用RED5录制视频流

perl - 有人知道 Perl 验证器吗

android intent startActivity() 和 sendBroadcast()

Eclipse/CFBuilder - 跟踪更改的文件。

java - 如何从专业开发人员的 Java IDE (IntelliJ IDEA) 运行 SpringBoot 应用程序

c++ - 应用程序中奇怪的执行错误

ios - Xcode 6 奇怪(空)对象在调试器中显示