开发者

How to solve FATAL EXCEPTION java.lang.RuntimeException: An error occured while executing doInBackground()

开发者 https://www.devze.com 2023-03-06 16:45 出处:网络
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

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.throwIndexOutOfBoundsEx开发者_运维技巧ception(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 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.


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!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消