When I first started to work on Android, I had to encounter some simple problems for the experts, but I was a newbie, here we will save some technical notes that I am engaged in Android development and hope they will be helpful to future users.
This article is original. Do not use it for commercial purposes. If you need to reprint the record, please keep the copyright information and notify me to request the right to reprint the record.
1. the following error message is displayed in the LogCat window:
01-30 12:13:15. 829: I/System. out (3043): waiting for debugger to settle...
01-30 12:13:16. 039: I/System. out (3043): debugger has settled (1342)
01-30 12:13:21. 570: D/AndroidRuntime (3043): Shutting down VM
01-30 12:13:21. 570: W/dalvikvm (3043): threadid = 1: thread exiting with uncaught exception (group = 0x40018578)
01-30 12:13:21. 640: E/AndroidRuntime (3043): fatal exception: main
01-30 12:13:21. 640: E/AndroidRuntime (3043): java. lang. RuntimeException: Unable to start activity ComponentInfo {program java. lang. NullPointerException
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. app. ActivityThread. initialize mlaunchactivity (ActivityThread. java: 1651)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. app. ActivityThread. handleLaunchActivity (ActivityThread. java: 1667)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. app. ActivityThread. access $1500 (ActivityThread. java: 117)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. app. ActivityThread $ H. handleMessage (ActivityThread. java: 935)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. OS. Handler. dispatchMessage (Handler. java: 99)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. OS. Looper. loop (Looper. java: 130)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. app. ActivityThread. main (ActivityThread. java: 3687)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at java. lang. reflect. Method. invokeNative (Native Method)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at java. lang. reflect. Method. invoke (Method. java: 507)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at com. android. internal. OS. ZygoteInit $ MethodAndArgsCaller. run (ZygoteInit. java: 867)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at com. android. internal. OS. ZygoteInit. main (ZygoteInit. java: 625)
01-30 12:13:21. 640: E/AndroidRuntime (3043 ):
At dalvik. system. NativeStart. main (Native Method)
01-30 12:13:21. 640: E/AndroidRuntime (3043): Caused by: java. lang. NullPointerException
01-30 12:13:21. 640: E/AndroidRuntime (3043): at loger.gps.any2go.com. GpsActivity. onCreate (GpsActivity. java: 31)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. app. Instrumentation. callActivityOnCreate (Instrumentation. java: 1047)
01-30 12:13:21. 640: E/AndroidRuntime (3043): at android. app. ActivityThread. initialize mlaunchactivity (ActivityThread. java: 1615)
01-30 12:13:21. 640: E/AndroidRuntime (3043):... 11 more
From the above information, we can see that LogCat has helped us locate the specific problem, as shown in the cold color of the first line, the same occurs in the Main function, and the exception is NullPointerException, the specific line occurs in the green background, in the OnCreate function. GPSActive. java: 31 rows.
In this way, we found the problem in detail. This problem confused me for an afternoon, and now I have to look at it again. In just a few minutes, I found it and published it here to encourage everyone.
From slyzhang's Blog Home