Zoom Button Crash in 6.1.0
See original GitHub issueIssue Type
[X] Bug
Description and/or steps/code to reproduce the problem
Plugging 6.1.0 into gradle to replace 6.0.3 in my App, all things so far seem fine. All but the (standard) zoom buttons: These bottons relyably crash 100% of the time after app start. With plenty of stack trace which all seem repeations of this (one click creates hundreds and so far I only checked manually):
2019-03-25 09:26:07.704 ? E/AndroidRuntime: at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
2019-03-25 09:26:07.704 ? E/AndroidRuntime: at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.end(ValueAnimator.java:1133)
at org.osmdroid.views.MapController.animateTo(MapController.java:167)
at org.osmdroid.views.MapController.animateTo(MapController.java:137)
at org.osmdroid.views.MapController.animateTo(MapController.java:183)
at org.osmdroid.views.MapController.animateTo(MapController.java:129)
at org.osmdroid.views.MapView.setZoomLevel(MapView.java:492)
at org.osmdroid.views.MapController$MapAnimatorListener.onAnimationUpdate(MapController.java:520)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1547)
at android.animation.ValueAnimator.animateBasedOnTime(ValueAnimator.java:1339)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1471)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1170)
at android.view.Choreographer.doCallbacks(Choreographer.java:984)
at android.view.Choreographer.doFrame(Choreographer.java:806)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1158)
at android.os.Handler.handleCallback(Handler.java:873)
2019-03-25 09:26:07.704 ? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Once the user has done some manual (gesture or in my App location bookmarks) zooming or location change, this does not happen any more. But when the user hits zoom directly after start it crashes relyably.
The stack traces seem to depend on Android version, on Android 4.2.2 I get the following:
03-25 09:42:27.976 de.spieleck.app.badgers.debug E/AndroidRuntime: FATAL EXCEPTION: main java.lang.StackOverflowError
(which matches to the amount of output on Android 9 where log is just to fast to keep the start of problems in Android Studio memory).
Environment
My Badge®s App, Android 4.2.2, 9 checked here
If it’s a bug, version(s) of android this affects:
A9, 4.2.2
Version of osmdroid the issue relates to:
6.1.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:39 (14 by maintainers)
if we are all in concur on this, i can merge and get a new version rolled out today or tomorrow
Success today!
The issue is related to any app having a Snappable overlay (an
OwnLocationOverlay
):This code in
setZoomLevel
https://github.com/osmdroid/osmdroid/blob/8bcb806f8d763e4a1e36813c8ac6b7e763cb2b6f/osmdroid-android/src/main/java/org/osmdroid/views/MapView.java#L500 getstrue
fromonSnapItem
https://github.com/osmdroid/osmdroid/blob/832e0813d394e83106c5cdc3beb642d38d5dbade/osmdroid-android/src/main/java/org/osmdroid/views/overlay/DefaultOverlayManager.java#L270 and continuously callsanimateTo
leading to SO:and onSnapItem:
I could repro stack overflow by hardcoding
return true;
inonSnapToItem
; patch this below.and zoom out to stack overflow at will in Osmdroid-android test app!