icapps / flutter-background-location-tracker

Flutter background location tracker plugin. (Android / iOS)
MIT License
31 stars 30 forks source link

app craches for android after updating flutter to 3.10.5 #56

Closed AhkamKhallaf closed 1 year ago

AhkamKhallaf commented 1 year ago

after i update flutter sdk to 3.10.5 , android crashes , it gives this error java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/~~cWwxJRjQAGic9jP-u6wKxQ==/sp.ozeesalon.com-vDRVua3oNjSgx-Zmz9FypQ==/base.apk) E/AndroidRuntime(16057): at com.icapps.background_location_tracker.service.LocationUpdatesService.getLastLocation(LocationUpdatesService.kt:215) E/AndroidRuntime(16057): at com.icapps.background_location_tracker.service.LocationUpdatesService.onCreate(LocationUpdatesService.kt:74) E/AndroidRuntime(16057): at android.app.ActivityThread.handleCreateService(ActivityThread.java:4487) E/AndroidRuntime(16057): at android.app.ActivityThread.access$1700(ActivityThread.java:247) E/AndroidRuntime(16057): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2072) E/AndroidRuntime(16057): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(16057): at android.os.Looper.loopOnce(Looper.java:201) E/AndroidRuntime(16057): at android.os.Looper.loop(Looper.java:288) E/AndroidRuntime(16057): at android.app.ActivityThread.main(ActivityThread.java:7839) E/AndroidRuntime(16057): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(16057): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) E/AndroidRuntime(16057): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

, out put of flutter doctor --version Flutter 3.10.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision 796c8ef792 (4 weeks ago) • 2023-06-13 15:51:02 -0700 Engine • revision 45f6e00911 Tools • Dart 3.0.5 • DevTools 2.23.1

vanlooverenkoen commented 1 year ago

Previously it did work? Which device are you using? Is it possible to create a minimal example project that we can run where you have this issue? So we can reproduce it and fix the issue

geekz-reno commented 1 year ago

until the pull request was merged you can use this fork

  background_location_tracker:
    git:
      url: https://github.com/geekz-reno/flutter-background-location-tracker.git
      ref: master

credit to @resfandiari for create pull request

run flutter clean && flutter pub get and use location plugin instead of geolocator.

AhkamKhallaf commented 1 year ago

Previously it did work? Which device are you using? Is it possible to create a minimal example project that we can run where you have this issue? So we can reproduce it and fix the issue

yes , it was worked very well but after updating flutter to latest , it became crashed, i use android emulator pixel 2 api 31 , when app just runs , it crashes

ikbendewilliam commented 1 year ago

I can confirm that it is an issue, I've also updated an app to 3.10 with the same error. However, the PR #53 from resfandiari fixes this. For now you can use it by changing your dependency to:

background_location_tracker:
  git: https://github.com/resfandiari/flutter-background-location-tracker.git

Once we merge that and release a new version, you can change to the new version 🙂

ikbendewilliam commented 1 year ago

Version 1.4.1 is released, this fixed the issues I encountered with 3.10