Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location updates incompatible with Play Services Location v21 #1752

Closed
jiurchuk opened this issue Oct 16, 2022 · 6 comments
Closed

Location updates incompatible with Play Services Location v21 #1752

jiurchuk opened this issue Oct 16, 2022 · 6 comments
Labels
bug 🪲 Something isn't working

Comments

@jiurchuk
Copy link

jiurchuk commented Oct 16, 2022

Environment

  • Android OS version: 8.0
  • Devices affected: Samsung Galaxy J7
  • Maps SDK Version: 10.8.1
  • Play Services Location: 21.0.0 (com.google.android.gms:play-services-location:21.0.0)

Observed behavior and steps to reproduce

Display a view with the Map and add the ability to receive Location Updates via the Fused Location Provider.

Expected behavior

Receive location updates.

Notes / preliminary analysis

Version 21.0.0 included a change which makes Mapbox incompatible with it.
I switched back to version 20.0.0 and everything works flawlessly.

Error stacktrace

FATAL EXCEPTION: main
Process: com.fauno.android.app, PID: 5386
java.lang.IncompatibleClassChangeError: The method 'com.google.android.gms.tasks.Task com.google.android.gms.location.FusedLocationProviderClient.requestLocationUpdates(com.google.android.gms.location.LocationRequest, com.google.android.gms.location.LocationCallback, android.os.Looper)' was expected to be of type virtual but instead was found to be of type interface (declaration of 'com.mapbox.android.core.location.GoogleLocationEngineImpl' appears in /data/app/com.fauno.android.app-ytL-iJQVqITXVMY4jl5lnQ==/base.apk:classes18.dex)
    at com.mapbox.android.core.location.GoogleLocationEngineImpl.requestLocationUpdates(GoogleLocationEngineImpl.java:58)
    at com.mapbox.android.core.location.GoogleLocationEngineImpl.requestLocationUpdates(GoogleLocationEngineImpl.java:26)
    at com.mapbox.android.core.location.LocationEngineProxy.requestLocationUpdates(LocationEngineProxy.java:34)
    at com.mapbox.maps.plugin.locationcomponent.DefaultLocationProvider.requestLocationUpdates(DefaultLocationProvider.kt:60)
    at com.mapbox.maps.plugin.locationcomponent.DefaultLocationProvider.requestLocationUpdates$lambda-2(DefaultLocationProvider.kt:66)
    at com.mapbox.maps.plugin.locationcomponent.DefaultLocationProvider.$r8$lambda$POSidhOF8Oq6uBMwTE9O9Q6vAXo(Unknown Source:0)
    at com.mapbox.maps.plugin.locationcomponent.DefaultLocationProvider$$ExternalSyntheticLambda1.run(Unknown Source:2)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6942)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Additional links and references

N/A

@jiurchuk jiurchuk added the bug 🪲 Something isn't working label Oct 16, 2022
@jush
Copy link
Member

jush commented Oct 17, 2022

Thanks for reporting this issue.

Indeed, Google Play Services has introduces a breaking change. See release notes here: https://developers.google.com/android/guides/releases#october_13_2022

As you already mentioned please keep using Google Play Services Location 20.0.0 for the time being.

@djdance
Copy link

djdance commented Dec 15, 2022

confirmed.
it still works with mapbox 9.6.1 and play-services-location:20.0.0

@jush
Copy link
Member

jush commented Dec 16, 2022

This issue has been resolved in v10.10.0.

It's now possible to use Google Play Services Location 20 or 21.

@clembou
Copy link

clembou commented Jan 11, 2023

@jush any chance you could point me to the PR that addressed this issue? I looked at the diff between 10.9.1 and 10.10.0 and nothing looked related.
We are facing the same issue on another project and finding it hard to support both version 20 and 21 in our library, I was hoping to steal some ideas from you. Thanks!

@jush
Copy link
Member

jush commented Jan 11, 2023

Unfortunately the change was done in one of our internal libraries.

We ended up using a tiny amount of reflection to call the methods regardless of being an interface or a class.

@andrasfecz
Copy link

@jush Any chance this fix could be added for mapbox-gl-native too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants