transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
649 stars 241 forks source link

Application crashes on restart #1175

Closed codenomaddev closed 12 months ago

codenomaddev commented 12 months ago

The application starts and works, but when it restarts there is a crash in main and it does not work again.

environment: sdk: '>=3.0.3 <4.0.0'

dependencies:

flutter: sdk: flutter bloc: ^8.1.0 connectivity_plus: ^5.0.1 cupertino_icons: ^1.0.2 device_information: ^0.0.4 device_info_plus: ^9.0.2 dio: ^5.3.2 email_validator: ^2.1.17 equatable: ^2.0.5 expandable: any flutter_bloc: ^8.1.1 flutter_secure_storage: ^9.0.0 font_awesome_flutter: ^10.3.0 image_picker: ^1.0.4 kiwi: any geolocator: 9.0.2 path_provider: ^2.0.15 permission_handler: ^11.0.1 provider: any shared_preferences: ^2.0.15 uuid: ^4.1.0 url_launcher: any intl: ^0.18.1 flutter_staggered_animations: ^1.1.1 material_design_icons_flutter: ^7.0.7296 map_launcher: ^3.0.1 flutter_svg: ^2.0.4 animations: flutter_mapbox_navigation: 0.2.2 oktoast: ^3.3.1 package_info_plus: ^4.0.2 onesignal_flutter: ^5.0.3 app_tracking_transparency: ^2.0.4 flutter_background_geolocation: ^4.13.5 sembast: ^3.4.9 path: ^1.8.3 draggable_bottom_sheet: ^1.0.2 loader_overlay: ^2.3.0 flutter_spinkit: ^5.2.0

christocracy commented 12 months ago

If you have a crash, the first thing to do -- before posting an issue -- is get your stacktrace from the logs. There is always a stacktrace, explaining the exact cause.

codenomaddev commented 12 months ago

I was only able to obtain the errors through Flutter Logs, because when running in Debug the error does not occur.

Showing sdk gphone x86 logs: E/AndroidRuntime(14683): FATAL EXCEPTION: main E/AndroidRuntime(14683): Process: com.fieldcorp.globo.motorista, PID: 14683 E/AndroidRuntime(14683): java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.ActivityRecognitionClient, but class was expected (declaration of 'com.google.android.gms.location.ActivityRecognitionClient' appears in /data/app/~~xXDbQKCTx83G7oKyyqQKcA==/com.fieldcorp.globo.motorista-oFW1yCf8UJaQDu3No9ulxQ==/base.apk) E/AndroidRuntime(14683): at com.mapbox.common.movement.GoogleActivityRecognition.start(GoogleActivityRecognition.kt:115) E/AndroidRuntime(14683): at com.mapbox.common.movement.AndroidMovementMonitor.registerObserver(AndroidMovementMonitor.kt:60) E/AndroidRuntime(14724): FATAL EXCEPTION: main E/AndroidRuntime(14724): Process: com.fieldcorp.globo.motorista, PID: 14724 E/AndroidRuntime(14724): java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.ActivityRecognitionClient, but class was expected (declaration of 'com.google.android.gms.location.ActivityRecognitionClient' appears in /data/app/~~xXDbQKCTx83G7oKyyqQKcA==/com.fieldcorp.globo.motorista-oFW1yCf8UJaQDu3No9ulxQ==/base.apk) E/AndroidRuntime(14724): at com.mapbox.common.movement.GoogleActivityRecognition.start(GoogleActivityRecognition.kt:115) E/AndroidRuntime(14724): at com.mapbox.common.movement.AndroidMovementMonitor.registerObserver(AndroidMovementMonitor.kt:60) E/AndroidRuntime(14770): FATAL EXCEPTION: main E/AndroidRuntime(14770): Process: com.fieldcorp.globo.motorista, PID: 14770 E/AndroidRuntime(14770): java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.ActivityRecognitionClient, but class was expected (declaration of 'com.google.android.gms.location.ActivityRecognitionClient' appears in /data/app/~~xXDbQKCTx83G7oKyyqQKcA==/com.fieldcorp.globo.motorista-oFW1yCf8UJaQDu3No9ulxQ==/base.apk) E/AndroidRuntime(14770): at com.mapbox.common.movement.GoogleActivityRecognition.start(GoogleActivityRecognition.kt:115) E/AndroidRuntime(14770): at com.mapbox.common.movement.AndroidMovementMonitor.registerObserver(AndroidMovementMonitor.kt:60)

christocracy commented 12 months ago

Search the issues with your error "IncompatibleClassChangeError".

This has been posted dozens of times before.

codenomaddev commented 12 months ago

log.txt

Below is the dependency report. I tried updating the playServicesLocationVersion to 20.0.0 as it is currently 21.0.1 and it didn't work. I suggest you be clearer to resolve this problem because before getting in touch I checked all the possible solutions in the Issues. I'm only getting in touch as a last resort.

christocracy commented 12 months ago

Google made a breaking change to play-services location.

This plug-in is smart: it allows you to control the version of play-services-location which is included.

Not all plug-in's are smart like this. Most hard-code the version (eg Geolocator).

When one plugin includes v21+ and another includes v20, your app will crash.

You need to interrogate all your plugin to find out which one is breaking your app.

Learn how to analyze your dependencies using ./gradlew app:dependencies.

This plug-in is not at fault.