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
答案 0 :(得分:4)
您似乎尝试将String
传递给JSONObject
,但却传递了null
。在JSONTokener
上构建时,null
为documented as throwing NullPointerException
。
另外,如果你想知道为什么有两个堆栈跟踪,那是因为你的Activity
在它的onCreate
方法中引发了一个异常,所以你看到你的方法的堆栈跟踪,然后是一个栈跟踪,表明系统无法创建您的活动。 (如果您正在使用Eclipse进行调试,则应该在Activity
中使用正确的代码行。)
答案 1 :(得分:0)
您的调试包含“消费者已关闭的输入频道或发生错误”我在测试我的应用程序离线功能时关闭了我的互联网时收到了这个...当然服务器没有返回您的JSON ....我建议更多错误检查这些功能......