0

my android app based on maps, present in google play, users experimets a crash.
It seems appear once when gps localization is searcheing. Here there is the exeption that 2 user has send to me:

class: java.util.ConcurrentModificationException method: ArrayList$ArrayListIterator.next()

Stack:

java.util.ConcurrentModificationException
    at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:576)
    at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:44)
    at com.google.android.maps.MapView.onDraw(MapView.java:530)
    at android.view.View.draw(View.java:6970)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.View.draw(View.java:6973)
    at android.widget.FrameLayout.draw(FrameLayout.java:357)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.View.draw(View.java:6973)
    at android.widget.FrameLayout.draw(FrameLayout.java:357)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
    at android.view.View.draw(View.java:6973)
    at android.widget.FrameLayout.draw(FrameLayout.java:357)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1971)
    at android.view.ViewRoot.draw(ViewRoot.java:1600)
    at android.view.ViewRoot.performTraversals(ViewRoot.java:1321)
    at android.view.ViewRoot.handleMessage(ViewRoot.java:1957)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:143)
    at android.app.ActivityThread.main(ActivityThread.java:4277)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)

In simulation it doesn't apper. Any idea about that?

Tx in advance.

EDIT Luis suspects something wrong in my thread:

    public void onLocationChanged(Location location) {
    // TODO Auto-generated method stub
    Log.d(TAG, "onLocationChanged with location " + location.toString());
    // Displays lat, long, altitude and bearing
    String text = String.format("Lat:\t %f\nLong:\t %f\nAlt:\t %f\nBearing:\t %f", location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getBearing());
    this.locationText.setText(text);


    try {
        // This gets a list of addresses 
        List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 10);
        for (Address address : addresses) {
            this.locationText.append("\n" + address.getAddressLine(0));
        }

        // Convert latitude and longitude into int that the GeoPoint constructor can understand
        int latitude = (int)(location.getLatitude() * 1000000);
        int longitude = (int)(location.getLongitude() * 1000000);

        GeoPoint point = new GeoPoint(latitude,longitude);
        mapController.animateTo(point);

    } catch (IOException e) {
        Log.e("LocateMe", "Could not get Geocoder data", e);
    }
}
}
doxsi
  • 1,002
  • 19
  • 42

1 Answers1

1

Are you using threads in your code?

It looks like one of your threads is trying to add something to the overlays list while MapView class was iterating through it to draw them.

You need to post relevant code to have a more concrete answer.

Regards.

Luis
  • 11,978
  • 3
  • 27
  • 35