mapbox / mapbox/mapbox-maps-android

IllegalArgumentException kotlin.math.MathKt__MathJVMKt in roundToInt

Open
#2,074 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version: 11
- Devices affected: OnePlusPro8
- Maps SDK Version: 10.11.2

## Observed behavior and steps to reproduce

Unknown

## Expected behavior

App not to crash

## Notes / preliminary analysis

There are no references to custom code in error logs, all looks related to mapbox.

## Additional links and references

`kotlin.math.MathKt__MathJVMKt in roundToInt at line 619

com.mapbox.maps.plugin.viewport.transition.TransitionUtilsKt in roundTo at line 46

com.mapbox.maps.plugin.viewport.transition.TransitionUtilsKt in normalizeBearing at line 37

com.mapbox.maps.plugin.viewport.transition.MapboxViewportTransitionFactory in transitionFromLowZoomToHighZoom at line 72

com.mapbox.maps.plugin.viewport.transition.DefaultViewportTransitionImpl in createAnimatorSet at line 137

com.mapbox.maps.plugin.viewport.transition.DefaultViewportTransitionImpl in run$lambda-3 at line 68

com.mapbox.maps.plugin.viewport.transition.DefaultViewportTransitionImpl in $r8$lambda$Dm5KN4W8ZFs-jPnk6TvM6D2XbLA

com.mapbox.maps.plugin.viewport.transition.DefaultViewportTransitionImpl$$ExternalSyntheticLambda1 in onNewData at line 15

com.mapbox.maps.plugin.viewport.state.FollowPuckViewportStateImpl in notifyViewportStateDataObserver at line 81

com.mapbox.maps.plugin.viewport.state.FollowPuckViewportStateImpl in notifyLatestViewportData at line 69

com.mapbox.maps.plugin.viewport.state.FollowPuckViewportStateImpl in indicatorPositionChangedListener$lambda-0 at line 51

com.mapbox.maps.plugin.viewport.state.FollowPuckViewportStateImpl in $r8$lambda$1FFQMeE76PqUckIDkzhBjeBUQTc

com.mapbox.maps.plugin.viewport.state.FollowPuckViewportStateImpl$$ExternalSyntheticLambda2 in onIndicatorPositionChanged at line 2

com.mapbox.maps.plugin.locationcomponent.LocationComponentPluginImpl in indicatorPositionChangedListener$lambda-1 at line 81

com.mapbox.maps.plugin.locationcomponent.LocationComponentPluginImpl in $r8$lambda$tH84PKxP_CGg6Eh9PozddvGFbNI

com.mapbox.maps.plugin.locationcomponent.LocationComponentPluginImpl$$ExternalSyntheticLambda3 in onIndicatorPositionChanged at line 2

com.mapbox.maps.plugin.locationcomponent.animators.PuckPositionAnimator in updateLayer at line 10

com.mapbox.maps.plugin.locationcomponent.animators.PuckPositionAnimator in updateLayer at line 6

com.mapbox.maps.plugin.locationcomponent.animators.PuckAnimator$1$1 in invoke at line 36

com.mapbox.maps.plugin.locationcomponent.animators.PuckAnimator$1$1 in invoke at line 33

com.mapbox.maps.threading.AnimationThreadController in postOnMainThread at line 67

com.mapbox.maps.plugin.locationcomponent.animators.PuckAnimator in _init_$lambda-0 at line 33

com.mapbox.maps.plugin.locationcomponent.animators.PuckAnimator in $r8$lambda$DKuRutUBCyf6yKd5UEMf-U8meWw

com.mapbox.maps.plugin.locationcomponent.animators.PuckAnimator$$ExternalSyntheticLambda0 in onAnimationUpdate at line 2

android.animation.ValueAnimator in animateValue at line 1566

android.animation.ValueAnimator in animateBasedOnTime at line 1357

android.animation.ValueAnimator in doAnimationFrame at line 1489

android.animation.AnimationHandler in doAnimationFrame at line 146

android.animation.AnimationHandler in access$100 at line 37

android.animation.AnimationHandler$1 in doFrame at line 54

android.view.Choreographer$CallbackRecord in run at line 970

android.view.Choreographer in doCallbacks at line 796

android.view.Choreographer in doFrame at line 727

android.view.Choreographer$FrameDisplayEventReceiver in run at line 957

android.os.Handler in handleCallback at line 938

android.os.Handler in dispatchMessage at line 99

android.os.Looper in loop at line 223

android.app.ActivityThread in main at line 7680

java.lang.reflect.Method in invoke

com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 592

com.android.internal.os.ZygoteInit in main at line 947`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TransitionUtilsKt.roundTo and normalizeBearing at the reported lines, then trace their callers in MapboxViewportTransitionFactory and DefaultViewportTransitionImpl. Determine which value causes roundToInt to throw during the FollowPuckViewportStateImpl location update, reproduce the crash if possible, and verify that the transition no longer crashes in that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.