AltBeacon / android-beacon-library

Allows Android apps to interact with BLE beacons
Apache License 2.0
2.84k stars 837 forks source link

ConcurrentModificationException #116

Closed furkanvarol closed 9 years ago

furkanvarol commented 9 years ago

Recently I started to have this exception. Sometimes it crashes the app and sometimes don't. I will try to investigate the problem.

E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.util.ConcurrentModificationException
            at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
            at java.util.HashMap$KeyIterator.next(HashMap.java:833)
            at org.altbeacon.beacon.BeaconManager$1.onServiceConnected(BeaconManager.java:574)
            at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1114)
            at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1131)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5579)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
            at dalvik.system.NativeStart.main(Native Method)
mattwritescode commented 9 years ago

@furkanvarol this is already fixed correct? Or is this somehow separate from https://github.com/AltBeacon/android-beacon-library/pull/117?

furkanvarol commented 9 years ago

I mixed my work email in #117 so I push again in #118. If you got the particular error that wrote in first comment than yes, I believe it is fixed.

You can check it out, it was a single line fix actually. I just removed Map's put method in a foreach (BeaconManager's service connection handler).