Please provide the following:
- SDK Version: 48
- Platforms(Android/iOS/web/all): Android
Location.getCurrentPositionAsync()
is currently not working on android device.
Error :
[Error: Encountered an exception while calling native method: Exception occurred while executing exported method getCurrentPositionAsync on module ExpoLocation: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/~~Wgqj3r99uKWvrH_B0MaJug==/com.app.dev-ZD2IwBYB-aky0AQxmxqpyA==/base.apk!classes6.dex)]
It was working fine before. I did some research and it may be caused by the last update of google play service : (Release Notes | Google Play services | Google for Developers)
October 13, 2022
- The latest update to the
play-services-location
library includes the following changes:FusedLocationProviderClient
,ActivityRecognitionClient
,GeofencingClient
andSettingsClient
are now interfaces instead of classes, which helps enforce correct usage and improves testability.
As the error above says :
Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected
As the release says :
FusedLocationProviderClient, ... are now interfaces instead of classes
Any solution for this ?
EDIT from the documentation :
Warning: This release of play-services-location
(21.0.0) has a known issue that can break SettingsClient
APIs. All clients should update to the 21.0.1 release of play-services-location
which fixes this issue.