Closed codenomaddev closed 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.
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)
Search the issues with your error "IncompatibleClassChangeError".
This has been posted dozens of times before.
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.
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.
The application starts and works, but when it restarts there is a crash in main and it does not work again.
Plugin version: ^4.13.5
Platform: Android
OS version:
Device manufacturer / model: On the emulator or on the Samsung Note 20 ultra.
Flutter info (
flutter doctor
): [√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [versÆo 10.0.22635.2700], locale pt-BR) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.4) [√] Android Studio (version 2022.1) [√] VS Code (version 1.84.2) [√] Connected device (4 available) ! Device emulator-5554 is offline. [√] Network resourcesPlugin config:
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