Search code examples
androidandroid-maps-v2

IllegalArgumentException: Negative latSpan


I saw this crash in Crashlytics of my app. And i have no clue what could be wrong.

Anyone have any suggestions why this crash could happen?

Fatal Exception: java.lang.IllegalArgumentException: Negative latSpan: -38.62544418468382
       at com.google.maps.api.android.lib6.common.m.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (120300-0):5)
       at com.google.maps.api.android.lib6.impl.ax.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (120300-0):4)
       at com.google.maps.api.android.lib6.impl.cx.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (120300-0):3)
       at com.google.maps.api.android.lib6.impl.cx.onClick(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (120300-0):5)
       at android.view.View.performClick(View.java:7869)
       at android.view.View.performClickInternal(View.java:7838)
       at android.view.View.access$3600(View.java:886)
       at android.view.View$PerformClick.run(View.java:29362)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:8019)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

p.s. I don't use mock location provider in my app.

EDIT 1: added bug report. https://issuetracker.google.com/issues/168724192
Not sure why though, because google usually just doesn't care.


Solution

  • As answered by google team in https://issuetracker.google.com/issues/168724192 The issue is caused by "My location" button.

    This issue could be avoided by implementing your own "My location" button. with necessary checks.

    I checked with our other app that has custom "my location" button. And it seems that this could be a viable solution, even tough i didn't implemented any specific checks in that product.

    Edit: Btw my way of checking was through Firebase crashlytics. Project with default "My location" button has These kind of crashes and the project with custom button - doesn't.