09-11 14:39:52.120: ERROR/AndroidRuntime(12051): FATAL EXCEPTION: Thread-431 09-11 14:39:52.120: ERROR/AndroidRuntime(12051): Process: com.clockrock.freeshare, PID: 12051 09-11 14:39:52.120: ERROR/AndroidRuntime(12051): java.lang.NullPointerException: println needs a message 09-11 14:39:52.120: ERROR/AndroidRuntime(12051): at android.util.Log.println_native(Native Method) 09-11 14:39:52.120: ERROR/AndroidRuntime(12051): at android.util.Log.i(Log.java:160) 09-11 14:39:52.120: ERROR/AndroidRuntime(12051): at com.clockrock.freeshare.MyPublishActivity$5.run(MyPublishActivity.java:214)
09-11 14:39:52.120: ERROR/AndroidRuntime(12051): at java.lang.Thread.run(Thread.java:848)
错误原因是因为:输出的log内容没有初始化,
09-11 15:29:43.832: WARN/System.err(13065): org.json.JSONException: No value for likeCnt 09-11 15:29:43.832: WARN/System.err(13065): at org.json.JSONObject.get(JSONObject.java:355) 09-11 15:29:43.832: WARN/System.err(13065): at org.json.JSONObject.getString(JSONObject.java:515) 09-11 15:29:43.832: WARN/System.err(13065): at com.clockrock.tools.HttpTools.getMyPubData(HttpTools.java:616) 09-11 15:29:43.832: WARN/System.err(13065): at com.clockrock.freeshare.MyPublishActivity$4.run(MyPublishActivity.java:196) 09-11 15:29:43.832: WARN/System.err(13065): at java.lang.Thread.run(Thread.java:848)
错误原因:我在解析json 字符串的时候,返回来的键值和我optString的设置没有一致
09-11 15:33:04.697: WARN/dalvikvm(13180): threadid=13: uncaught exception occurred 09-11 15:33:04.697: WARN/System.err(13180): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 09-11 15:33:04.700: WARN/System.err(13180): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 09-11 15:33:04.701: WARN/System.err(13180): at java.util.ArrayList.set(ArrayList.java:481) 09-11 15:33:04.701: WARN/System.err(13180): at com.clockrock.tools.HttpTools.getMyPubData(HttpTools.java:620) 09-11 15:33:04.701: WARN/System.err(13180): at com.clockrock.freeshare.MyPublishActivity$3.run(MyPublishActivity.java:145) 09-11 15:33:04.701: WARN/System.err(13180): at java.lang.Thread.run(Thread.java:848) 09-11 15:33:04.701: WARN/dalvikvm(13180): threadid=13: calling UncaughtExceptionHandler 09-11 15:33:04.701: INFO/dalvikvm(13180): calling Ljava/lang/ThreadGroup;.uncaughtException 09-11 15:33:04.701: ERROR/AndroidRuntime(13180): FATAL EXCEPTION: Thread-438 09-11 15:33:04.701: ERROR/AndroidRuntime(13180): Process: com.clockrock.freeshare, PID: 13180 09-11 15:33:04.701: ERROR/AndroidRuntime(13180): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 09-11 15:33:04.701: ERROR/AndroidRuntime(13180): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 09-11 15:33:04.701: ERROR/AndroidRuntime(13180): at java.util.ArrayList.set(ArrayList.java:481) 09-11 15:33:04.701: ERROR/AndroidRuntime(13180): at com.clockrock.tools.HttpTools.getMyPubData(HttpTools.java:620) 09-11 15:33:04.701: ERROR/AndroidRuntime(13180): at com.clockrock.freeshare.MyPublishActivity$3.run(MyPublishActivity.java:145) 09-11 15:33:04.701: ERROR/AndroidRuntime(13180): at java.lang.Thread.run(Thread.java:848)
错误原因是:我定义了一个数组,我插入数据的时候用了set,而不是用的add方法 我好傻
09-11 15:33:04.703: WARN/ActivityManager(743): Force finishing activity com.clockrock.freeshare/.MyPublishActivity
09-11 15:36:35.758: WARN/System.err(743): java.lang.SecurityException: Neither user 10003 nor current process has android.permission.PACKAGE_USAGE_STATS. 09-11 15:36:35.758: WARN/System.err(743): at android.app.ContextImpl.enforce(ContextImpl.java:1876) 09-11 15:36:35.758: WARN/System.err(743): at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1905) 09-11 15:36:35.758: WARN/System.err(743): at com.android.server.am.UsageStatsService.getAllPkgUsageStats(UsageStatsService.java:862) 09-11 15:36:35.758: WARN/System.err(743): at com.android.internal.app.IUsageStats$Stub.onTransact(IUsageStats.java:113) 09-11 15:36:35.758: WARN/System.err(743): at android.os.Binder.execTransact(Binder.java:404) 09-11 15:36:35.759: WARN/System.err(743): at dalvik.system.NativeStart.run(Native Method)
这个其实不是问题,我也没有找到解决方案,但是我重新调试的时候就不报这个警告了 主要的原因估计还是我其他的地方错误了,listView的问题
今天好像又碰到了 我一开始学Android写listView的问题,就是创建一个adapter类的时候只知道吧getView写了 而把那些getCount给掉了,最后程序也不报错,数据访问也没有问题,哎,跟踪了好久才发现这个问题,
我只想说一句 很多时候我们总是在不经意间回到原点。