Sorry the application Sudoku has stopped unexpectly. Please try again
Help!
I’m having problems with my Sudoku application. I plugged in all the code to have my application remember the current position. Now when I run the application and I try to either start a new game or continue my Sudoku application says:
Sorry the application Sudoku (process org.example.sudoku) has stopped unexpectedly. Please try again.
It hasn’t done this in the past yet and I’m confused on where to go from here. I took a look at the logcat but I’m not sure what I should look for and how to fix it. Here is the logcat below
12-05 14:47:32.376: DEBUG/AndroidRuntime(289): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
12-05 14:47:32.376: DEBUG/AndroidRuntime(289): CheckJNI is ON
12-05 14:47:32.796: DEBUG/AndroidRuntime(289): —registering native functions --
12-05 14:47:34.306: DEBUG/AndroidRuntime(289): Shutting down VM
12-05 14:47:34.325: DEBUG/dalvikvm(289): Debugger has detached; object registry had 1 entries
12-05 14:47:34.345: INFO/AndroidRuntime(289): NOTE: attach of thread ‘Binder Thread #3’ failed
12-05 14:47:35.246: DEBUG/AndroidRuntime(297): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
12-05 14:47:35.246: DEBUG/AndroidRuntime(297): CheckJNI is ON
12-05 14:47:35.625: DEBUG/AndroidRuntime(297): —registering native functions --
12-05 14:47:36.985: INFO/ActivityManager(60): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0×10000000 cmp=org.example.sudoku/.Sudoku }
12-05 14:47:37.126: DEBUG/AndroidRuntime(297): Shutting down VM
12-05 14:47:37.146: DEBUG/dalvikvm(297): Debugger has detached; object registry had 1 entries
12-05 14:47:37.186: INFO/AndroidRuntime(297): NOTE: attach of thread ‘Binder Thread #3’ failed
12-05 14:47:37.359: INFO/ActivityManager(60): Start proc org.example.sudoku for activity org.example.sudoku/.Sudoku: pid=304 uid=10037 gids={}
12-05 14:47:39.327: INFO/ActivityManager(60): Displayed activity org.example.sudoku/.Sudoku: 2047 ms (total 333042 ms)
12-05 14:47:44.516: DEBUG/dalvikvm(128): GC_EXPLICIT freed 205 objects / 9864 bytes in 134ms
12-05 14:48:14.936: DEBUG/Sudoku(304): clicked on 0
12-05 14:48:14.957: INFO/ActivityManager(60): Starting activity: Intent { cmp=org.example.sudoku/.Game (has extras) }
12-05 14:48:15.146: DEBUG开发者_运维技巧/AndroidRuntime(304): Shutting down VM
12-05 14:48:15.146: WARN/dalvikvm(304): threadid=1: thread exiting with uncaught exception (group=0×4001d800)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): FATAL EXCEPTION: main
12-05 14:48:15.295: ERROR/AndroidRuntime(304): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.example.sudoku/org.example.sudoku.Game}: java.lang.NullPointerException
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.os.Looper.loop(Looper.java:123)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.reflect.Method.invoke(Method.java:521)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at dalvik.system.NativeStart.main(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): Caused by: java.lang.NullPointerException
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.content.ContextWrapper.getPackageName(ContextWrapper.java:120)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Activity.getLocalClassName(Activity.java:3478)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Activity.getPreferences(Activity.java:3512)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at org.example.sudoku.Game.<init>(Game.java:104)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.Class.newInstanceImpl(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.Class.newInstance(Class.java:1429)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): ... 11 more
12-05 14:48:15.376: WARN/ActivityManager(60): Force finishing activity org.example.sudoku/.Game
12-05 14:48:15.455: WARN/ActivityManager(60): Force finishing activity org.example.sudoku/.Sudoku
12-05 14:48:15.927: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{44049308 org.example.sudoku/.Game}
12-05 14:48:27.095: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{43f562c0 org.example.sudoku/.Sudoku}
12-05 14:48:27.202: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{44049308 org.example.sudoku/.Game}
12-05 14:49:20.407: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
Any help would be greatly appreciated. Thank you
-James
You need to look at line 104 of Game.java as it seems it may be the cause of a NullPointerException
Your error of interest is:
12-05 14:48:15.295: ERROR/AndroidRuntime(304): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.example.sudoku/org.example.sudoku.Game}: java.lang.NullPointerException
Usual error - your intent is not in the Manifest.xml
精彩评论