1

我一直在犯错误,这次我找不到问题。有人说 logcat 会显示有问题的行号,但是,我还没有找到这个很棒的资源。这是显示当我拉出键盘时应用程序崩溃时出现的错误的 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.
4

4 回答 4

2

行尾的那些数字(在文件名的括号中)是发生错误的行号。找到处理您的程序的文件并查看相应的行号 initcated(在本例中为 MainActivity.java 第 171 行)。

于 2013-06-14T15:14:33.733 回答
1

在logcat搜索栏写.java就可以看到这一行

com.daniel.kilometermilecoverter.MainActivity.onConfigurationChanged(MainActivity.java:171) 06-14 10:04:42.734: E/AndroidRuntime(29547): 在

于 2021-04-17T00:21:57.437 回答
0

com.daniel.kilometermilecoverter.MainActivity.onConfigurationChanged(MainActivity.java:171)06-14 10:04:42.734:E/AndroidRuntime(29547):在

于 2013-06-14T15:12:03.700 回答
0

这是你的活动和线路。

com.daniel.kilometermilecoverter.MainActivity.onConfigurationChanged(MainActivity.java:171) 06-14 10:04:42.744: E/AndroidRuntime(29547):

于 2013-06-14T15:12:10.053 回答