Issue with GetCurrentLocation.js in Mendix 10.18.3 Mobile Apps

0
We encountered a critical issue when using the GetCurrentLocation.js action from NanoflowCommons in a Mendix 10.18.3 mobile application. When attempting to retrieve the device's location, the app crashes with the following error: Caused by: java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.SettingsClient, but class was expected (declaration of 'com.google.android.gms.location.SettingsClient' appears in /data/app/~~2v_diTmhngGI_TeEptZiqg==/sr.pse.wfm_ogledziny-dTy2y0O-_31cAWwKMuJ6UA==/base.apk!classes2.dex)at com.agontuk.RNFusedLocation.RNFusedLocationModule.getCurrentPosition(RNFusedLocationModule.java:193)   Root Cause:This issue arises due to conflicting dependencies in the Mendix project: Mendix automatically includes:react-native-maps@1.14, which depends on com.google.android.gms:play-services-location:21.0.1react-native-geolocation-service@5.2.0, which depends on com.google.android.gms:play-services-location:17.0.0Since these libraries require different versions of play-services-location, a dependency conflict occurs, causing the application to crash when attempting to retrieve the device's location. This behavior is reproducible both in a custom-built Mendix mobile app and in Make It Native 10. Expected Behavior: The GetCurrentLocation.js action should work without causing a crash.Mendix should ensure that dependencies do not conflict or provide guidance on resolving them.Steps to Reproduce: Create a new Mendix 10.18.3 mobile application.Add a nanoflow that calls GetCurrentLocation.js from NanoflowCommons. Add maps to your applicationRun the app on an Android device (or Make It Native 10) or on phoneThe app crashes immediately when retrieving the location.
asked
3 answers
0

Hi Mateusz,

 

I've encountered the same issue and fixed this with in my native build based on this solution.

https://stackoverflow.com/questions/77274148/could-not-invoke-rnfusedlocation-getcurrentposition-react-native-geolocation-s

 

In android/build.gradle:

Add this line =>  playServicesLocationVersion = "21.0.1" inside buildscript.ext

In android/app/build.gradle:

Add this line or upgrade the version to 21.0.1 if older version already exists=>

implementation "com.google.android.gms:play-services:21.0.1"

answered
0

Hi, i saw there is an update of the native mobile resources module https://marketplace.mendix.com/link/component/109513, hope it fixes it

answered
0

they change react native tool (react-native-geolocation-service to @react-native-community/geolocation). For me is not good resolution. In new version on android 13 and 14 @react-native-community/geolocation works terrible on my phones

answered