查了下,网上有许多说可以用adb logcat的,可是没弄好。
又查了相关资料,Eclipse可以切换到debug试图,该视图下有logcat框,双击放大显示,还可以导出为文本!
然后再查阅相关资料即可:
贴上我的logcat分析下:
11-24 17:00:20.086: E/AndroidRuntime(293): FATAL EXCEPTION: main
11-24 17:00:20.086: E/AndroidRuntime(293): java.lang.NullPointerException
11-24 17:00:20.086: E/AndroidRuntime(293): at android.content.ContextWrapper.getResources(ContextWrapper.java:80)
11-24 17:00:20.086: E/AndroidRuntime(293): at com.example.android.apis.app.setMyWallPaper.getMyWall(setMyWallPaper.java:16)
11-24 17:00:20.086: E/AndroidRuntime(293): at com.example.android.apis.app.SetWallpaperActivity$3.onClick(SetWallpaperActivity.java:96)
11-24 17:00:20.086: E/AndroidRuntime(293): at android.view.View.performClick(View.java:2408)
11-24 17:00:20.086: E/AndroidRuntime(293): at android.view.View$PerformClick.run(View.java:8816)
11-24 17:00:20.086: E/AndroidRuntime(293): at android.os.Handler.handleCallback(Handler.java:587)
11-24 17:00:20.086: E/AndroidRuntime(293): at android.os.Handler.dispatchMessage(Handler.java:92)
11-24 17:00:20.086: E/AndroidRuntime(293): at android.os.Looper.loop(Looper.java:123)
11-24 17:00:20.086: E/AndroidRuntime(293): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-24 17:00:20.086: E/AndroidRuntime(293): at java.lang.reflect.Method.invokeNative(Native Method)
11-24 17:00:20.086: E/AndroidRuntime(293): at java.lang.reflect.Method.invoke(Method.java:521)
11-24 17:00:20.086: E/AndroidRuntime(293): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-24 17:00:20.086: E/AndroidRuntime(293): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-24 17:00:20.086: E/AndroidRuntime(293): at dalvik.system.NativeStart.main(Native Method)
等高人解答!