12-19 18:29:33.203: ERROR/AndroidRuntime(402): FATAL EXCEPTION: main
12-19 18:29:33.203: ERROR/AndroidRuntime(402): java.lang.RuntimeException: Unable to start activity ComponentInfo{ayanoo.forms/ayanoo.forms.FullFriendView}: java.lang.NullPointerException
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.os.Looper.loop(Looper.java:123)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.app.ActivityThread.main(ActivityThread.java:3647)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at java.lang.reflect.Method.invokeNative(Native Method)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at java.lang.reflect.Method.invoke(Method.java:507)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at dalvik.system.NativeStart.main(Native Method)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): Caused by: java.lang.NullPointerException
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:112)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at org.json.JSONTokener.nextValue(JSONTokener.java:90)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at org.json.JSONObject.<init>(JSONObject.java:154)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at org.json.JSONObject.<init>(JSONObject.java:171)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at ayanoo.forms.FullFriendView.fullProfile(FullFriendView.java:203)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at ayanoo.forms.FullFriendView.onCreate(FullFriendView.java:93)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
12-19 18:29:33.203: ERROR/AndroidRuntime(402): ... 11 more
12-19 18:29:35.623: ERROR/InputDispatcher(60): channel '4067f010 ayanoo.forms/ayanoo.forms.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
12-19 18:29:35.623: ERROR/InputDispatcher(60): channel '4067f010 ayanoo.forms/ayanoo.forms.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
12-19 18:29:35.993: ERROR/InputDispatcher(60): Received spurious receive callback for unknown input channel. fd=158, events=0x8

- 63,550
- 98
- 229
- 344
2 Answers
Looks like you tried to pass a String
to JSONObject
but instead passed null
. JSONTokener
is documented as throwing NullPointerException
when constructed on null
.
Also, if you’re wondering why there are two stacktraces, it’s because your Activity
threw an exception in its onCreate
method, so you see the stacktrace of your method and then a stacktrace indicating that the system could not create your activity. (If you’re debugging with Eclipse, it ought to break at the correct line of code in your Activity
.)

- 171,072
- 38
- 269
- 275
-
1why is null value, it brings JSON string from http connection , so when we have a low internet connection we get this error ! does this is the reason ? – Adham Dec 19 '10 at 20:11
-
I can’t answer that. Look at your code and watch the value as it goes from beginning to JSON, and perhaps check the HTTP client for an error code. – Josh Lee Dec 19 '10 at 22:21
You debug contains "Consumer closed input channel or an error occurred" I received this while turning off my internet while testing my apps offline ability... and of course the server is not returning your JSON.... I would suggest more error checking around those functions...

- 778
- 2
- 11
- 28