我有一个正在通过 Eclipse 调试的 Android Google Maps 应用程序。我收到此错误:
12-14 16:19:50.106: E/AndroidRuntime(2487): FATAL EXCEPTION: main
12-14 16:19:50.106: E/AndroidRuntime(2487): java.util.ConcurrentModificationException
12-14 16:19:50.106: E/AndroidRuntime(2487): at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
12-14 16:19:50.106: E/AndroidRuntime(2487): at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:41)
12-14 16:19:50.106: E/AndroidRuntime(2487): at com.google.android.maps.MapView.onDraw(MapView.java:494)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.View.draw(View.java:6740)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.View.draw(View.java:6743)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.widget.FrameLayout.draw(FrameLayout.java:352)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.View.draw(View.java:6743)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.widget.FrameLayout.draw(FrameLayout.java:352)
12-14 16:19:50.106: E/AndroidRuntime(2487): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewRoot.draw(ViewRoot.java:1407)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.os.Handler.dispatchMessage(Handler.java:99)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.os.Looper.loop(Looper.java:123)
12-14 16:19:50.106: E/AndroidRuntime(2487): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-14 16:19:50.106: E/AndroidRuntime(2487): at java.lang.reflect.Method.invokeNative(Native Method)
12-14 16:19:50.106: E/AndroidRuntime(2487): at java.lang.reflect.Method.invoke(Method.java:521)
12-14 16:19:50.106: E/AndroidRuntime(2487): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
12-14 16:19:50.106: E/AndroidRuntime(2487): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-14 16:19:50.106: E/AndroidRuntime(2487): at dalvik.system.NativeStart.main(Native Method)
我从不明确使用迭代器(我的代码没有,尽管显然某些调用包括一个),并且我确保任何类型的列表只能通过从返回的内容访问Collections.synchronizedList
,这应该可以解决这个问题,以我有限的理解. 因为我不知道我的代码库中的什么会导致这种情况,所以我不能真正发布代码片段。有谁知道其他“正常”原因?或者如何从 logcat 打印输出中获取任何有意义的位置(据我所知,唯一的文件引用是库文件)?