我已经得到一个持久的错误,这次我找不到问题。有些人说logcat会显示problamatic行号,但是,我还没有找到这个很棒的资源。 这是一个logcat,它显示了当我拔出键盘时应用程序崩溃时我得到的错误。
06-14 10:04:42.734: E/AndroidRuntime(29547): FATAL EXCEPTION: main
06-14 10:04:42.734: E/AndroidRuntime(29547): java.lang.NullPointerException
06-14 10:04:42.734: E/AndroidRuntime(29547): at com.daniel.kilometermilecoverter.MainActivity.onConfigurationChanged(MainActivity.java:171)
06-14 10:04:42.734: E/AndroidRuntime(29547): at android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:2956)
06-14 10:04:42.734: E/AndroidRuntime(29547): at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:3049)
06-14 10:04:42.734: E/AndroidRuntime(29547): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1015)
06-14 10:04:42.734: E/AndroidRuntime(29547): at android.os.Handler.dispatchMessage(Handler.java:99)
06-14 10:04:42.734: E/AndroidRuntime(29547): at android.os.Looper.loop(Looper.java:130)
06-14 10:04:42.734: E/AndroidRuntime(29547): at android.app.ActivityThread.main(ActivityThread.java:3740)
06-14 10:04:42.734: E/AndroidRuntime(29547): at java.lang.reflect.Method.invokeNative(Native Method)
06-14 10:04:42.734: E/AndroidRuntime(29547): at java.lang.reflect.Method.invoke(Method.java:507)
06-14 10:04:42.734: E/AndroidRuntime(29547): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
06-14 10:04:42.734: E/AndroidRuntime(29547): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
06-14 10:04:42.734: E/AndroidRuntime(29547): at dalvik.system.NativeStart.main(Native Method)
06-14 10:04:42.744: E/AndroidRuntime(29547): [FRANDRO_ERR_HANDLER] com_android_internal_os_RuntimeInit_BlueErrorHandler
06-14 10:04:42.744: E/AndroidRuntime(29547): [Blue Error Handler] Make Debugging Report file for main
06-14 10:04:42.744: E/AndroidRuntime(29547): java.lang.NullPointerException
06-14 10:04:42.744: E/AndroidRuntime(29547): at com.daniel.kilometermilecoverter.MainActivity.onConfigurationChanged(MainActivity.java:171)
06-14 10:04:42.744: E/AndroidRuntime(29547): at android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:2956)
06-14 10:04:42.744: E/AndroidRuntime(29547): at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:3049)
06-14 10:04:42.744: E/AndroidRuntime(29547): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1015)
06-14 10:04:42.744: E/AndroidRuntime(29547): at android.os.Handler.dispatchMessage(Handler.java:99)
06-14 10:04:42.744: E/AndroidRuntime(29547): at android.os.Looper.loop(Looper.java:130)
06-14 10:04:42.744: E/AndroidRuntime(29547): at android.app.ActivityThread.main(ActivityThread.java:3740)
06-14 10:04:42.744: E/AndroidRuntime(29547): at java.lang.reflect.Method.invokeNative(Native Method)
06-14 10:04:42.744: E/AndroidRuntime(29547): at java.lang.reflect.Method.invoke(Method.java:507)
06-14 10:04:42.744: E/AndroidRuntime(29547): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
06-14 10:04:42.744: E/AndroidRuntime(29547): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
06-14 10:04:42.744: E/AndroidRuntime(29547): at dalvik.system.NativeStart.main(Native Method)
06-14 10:04:44.766: E/AndroidRuntime(29547): [FRANDRO_ERR_HANDLER] Done.
答案 0 :(得分:2)
行末尾的那些数字(在带有文件名的括号中)是发生错误的行号。找到处理程序的文件,并查看相应的行号(在本例中为MainActivity.java第171行)。
答案 1 :(得分:1)
在 logcat 搜索栏中写入 .java 可以看到这一行
com.daniel.kilometermilecoverter.MainActivity.onConfigurationChanged(MainActivity.java:171) 06-14 10:04:42.734: E/AndroidRuntime(29547): at
答案 2 :(得分:0)
com.daniel.kilometermilecoverter.MainActivity.onConfigurationChanged( MainActivity.java:171 )06-14 10:04:42.734:E / AndroidRuntime(29547):at
答案 3 :(得分:0)
这是你的活动和线。
com.daniel.kilometermilecoverter.MainActivity.onConfigurationChanged(MainActivity.java:171)06-14 10:04:42.744:E / AndroidRuntime(29547):