如何解决 FATAL EXCEPTION java.lang.RuntimeException: 执行 doInBackground() 时发生错误

发布于 2024-11-08 06:21:24 字数 2299 浏览 1 评论 0原文

我正在开发与聊天相关的类似应用程序我正在使用后台同步类有时会出现强制关闭我正在使用.net webservices后台我收到消息和图像后台下载过程更新到ui

错误是:

05-17 05:24:17.925: ERROR/AndroidRuntime(1618): FATAL EXCEPTION: AsyncTask #1
05-17 05:24:17.925: ERROR/AndroidRuntime(1618): java.lang.RuntimeException: An error occured while executing doInBackground()
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at android.os.AsyncTask$3.done(AsyncTask.java:200)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.lang.Thread.run(Thread.java:1096)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.ArrayList.get(ArrayList.java:311)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at com.fitzgeraldsoftware.shout.presentationLayer.Shout$LatestMessage.doInBackground(Shout.java:1923)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     ... 4 more
05-17 05:24:17.956: WARN/ActivityManager(1105):   Force finishing activity com.fitzgeraldsoftware.shout.presentationLayer/.Shout
05-17 05:24:18.097: WARN/IInputConnectionWrapper(1618): showStatusIcon on inactive InputConnection

i am developing chat related similar application i am using backgrouund synchronous class some times force close is appear i am using .net webservices back ground i am recieve the messages and images background download process updating to ui

error is:

05-17 05:24:17.925: ERROR/AndroidRuntime(1618): FATAL EXCEPTION: AsyncTask #1
05-17 05:24:17.925: ERROR/AndroidRuntime(1618): java.lang.RuntimeException: An error occured while executing doInBackground()
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at android.os.AsyncTask$3.done(AsyncTask.java:200)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.lang.Thread.run(Thread.java:1096)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.ArrayList.get(ArrayList.java:311)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at com.fitzgeraldsoftware.shout.presentationLayer.Shout$LatestMessage.doInBackground(Shout.java:1923)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
05-17 05:24:17.925: ERROR/AndroidRuntime(1618):     ... 4 more
05-17 05:24:17.956: WARN/ActivityManager(1105):   Force finishing activity com.fitzgeraldsoftware.shout.presentationLayer/.Shout
05-17 05:24:18.097: WARN/IInputConnectionWrapper(1618): showStatusIcon on inactive InputConnection

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

萌梦深 2024-11-15 06:21:24

我面临同样的问题,几乎我花了半天时间,最后解决方案是关闭 eclipse 和 PC/笔记本电脑,重新启动它并运行应用程序。一切都运行良好。

I face the same problem and almost i sepnt half day on it, Finally the solution was Shut down you eclipse and PC/Laptop, Restart it and run the Application. Everything is running fine.

○愚か者の日 2024-11-15 06:21:24

您抛出了ArrayIndexOutOfBoundsException。检查 Shout.java 中 1923 年执行的代码以进行数组访问。如果您尝试按索引读取大于数组大小(1)的元素,则会引发异常。例如,如果出现以下情况,则会抛出该异常:

String [] strings = new String[0];
strings[0];// exception thrown!

You have ArrayIndexOutOfBoundsException thrown. Check the code executed on 1923 in Shout.java for array access. The exception is thrown if you try to read element by index which is more than array size(1). For example it is thrown if:

String [] strings = new String[0];
strings[0];// exception thrown!
撩动你心 2024-11-15 06:21:24

尝试项目 ->清理然后运行......我已经这样解决了......

Try Project -> Clean and then Run.... I have Solved it this way.......

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文