transistorsoft / flutter_background_geolocation

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

Crash on android #1049

Closed haidernaqvi87 closed 2 weeks ago

haidernaqvi87 commented 1 year ago

Your Environment

• No issues found!

Expected Behavior

Actual Behavior

as soon as user turns on the location the app crashes

Steps to Reproduce

1. 2. 3. 4.

Context

i just put a switch button for background location. If user switch it on, i start bg.BackgroundGeolocation.ready ... everything was working well and suddenly it starts crashing

Debug logs

E/TSLocationManager(32143): [c.t.l.a.BackgroundGeolocation$w0 uncaughtException] E/TSLocationManager(32143): ‼️ Uncaught Exception: Found interface com.google.android.gms.location.SettingsClient, but class was expected (declaration of 'com.google.android.gms.location.SettingsClient' appears in /data/app/com.pakpair.app-7mspJQlrT7D9A7tCw7Kptw==/base.apk!classes21.dex) E/TSLocationManager(32143): {"activityRecognitionInterval":10000,"allowIdenticalLocations":false,"authorization":{},"autoSync":true,"autoSyncThreshold":0,"backgroundPermissionRationale":{"title":"Allow {applicationName} to access this device's location even when closed or not in use?","message":"[CHANGEME] This app collects location data for FEATURE X and FEATURE Y.","positiveAction":"Change to \"{backgroundPermissionOptionLabel}\"","negativeAction":""},"batchSync":false,"configUrl":"","debug":false,"deferTime":0,"desiredAccuracy":-1,"desiredOdometerAccuracy":100,"disableAutoSyncOnCellular":false,"disableElasticity":false,"disableLocationAuthorizationAlert":false,"disableMotionActivityUpdates":false,"disableProviderChangeRecord":false,"disableStopDetection":false,"distanceFilter":40,"elasticityMultiplier":1,"enableHeadless":false,"enableTimestampMeta":false,"extras":{},"fastestLocationUpdateInterval":-1,"foregroundService":true,"geofenceInitialTriggerEntry":true,"geofenceModeHighAccuracy":false,"geofenceProximityRadius":1000,"geofenceTemplate":"","headers":{"Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2M2E4ODkzOWVmMzc4Yzg1MmVmYjVkOGUiLCJpYXQiOjE2ODQ0MTg4MTd9.fboTRE54fQ0P3D76bMBxoFe_Ktrw3B6ZeoHUzLx4O_I"},"headlessJobService":"com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask","heartbeatInterval":-1,"httpRootProperty":"location","httpTimeout":60000,"isMoving":false,"locationAuthorizationRequest":"Always","locationTemplate":"","locationTimeout":60,"locationUpdateInterval":1000,"locationsOrderDirection":"ASC","logLevel":5,"logMaxDays":3,"maxBatchSize":-1,"maxDaysToPersist":1,"maxRecordsToPersist":-1,"method":"POST","minimumActivityRecognitionConfidence":75,"motionTriggerDelay":0,"notification":{"layout":"","title":"","text":"Location Service activated","color":"","channelName":"TSLocationManager","channelId":"","smallIcon":"","largeIcon":"","priority":0,"sticky":false,"strings":{},"actions":[]},"params":{},"persist":true,"persistMode":2,"schedule":[],"scheduleUseAlarmManager":false,"speedJumpFilter":300,"startOnBoot":true,"stationaryRadius":25,"stopAfterElapsedMinutes":0,"stopOnStationary":false,"stopOnTerminate":false,"stopTimeout":5,"triggerActivities":"in_vehicle, on_bicycle, on_foot, running, walking","url":"http:\/\/192.168.100.58:3000\/crossPaths2","useSignificantChangesOnly":false,"enabled":true,"schedulerEnabled":false,"trackingMode":1,"odometer":0,"isFirstBoot":true,"didLaunchInBackground":false,"didDeviceReboot":false} E/TSLocationManager(32143): 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/com.pakpair.app-7mspJQlrT7D9A7tCw7Kptw==/base.apk!classes21.dex) E/TSLocationManager(32143): at com.transistorsoft.xms.g.location.SettingsClient.checkLocationSettings(Unknown Source:70) E/TSLocationManager(32143): at com.transistorsoft.locationmanager.activity.TSLocationManagerActivity.checkLocationSettings(Unknown Source:29) E/TSLocationManager(32143): at com.transistorsoft.locationmanager.activity.TSLocationManagerActivity.execute(Unknown Source:49) E/TSLocationManager(32143): at com.transistorsoft.locationmanager.activity.TSLocationManagerActivity.onCreate(Unknown Source:14) E/TSLocationManager(32143): at android.app.Activity.performCreate(Activity.java:7963) E/TSLocationManager(32143): at android.app.Activity.performCreate(Activity.java:7952) E/TSLocationManager(32143): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) E/TSLocationManager(32143): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3629) E/TSLocationManager(32143): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806) E/TSLocationManager(32143): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) E/TSLocationManager(32143): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/TSLocationManager(32143): at android I/TRuntime.CctTransportBackend(32143): Making request to: https://crashlyticsreports-pa.googleapis.com/v1/firelog/legacy/batchlog I/System.out(32143): (HTTPLog)-Static: isSBSettingEnabled false I/System.out(32143): (HTTPLog)-Static: isSBSettingEnabled false W/com.pakpair.ap(32143): Long monitor contention with owner ConnectivityThread (906) at void sun.misc.Unsafe.park(boolean, long)(Unsafe.java:-2) waiters=0 in void com.google.firebase.crashlytics.internal.common.CrashlyticsController.handleUncaughtException(com.google.firebase.crashlytics.internal.settings.SettingsProvider, java.lang.Thread, java.lang.Throwable, boolean) for 2.023s I/Process (32143): Sending signal. PID: 32143 SIG: 9 ``` PASTE_YOUR_LOGS_HERE ```
christocracy commented 1 year ago

Post the following files:

haidernaqvi87 commented 1 year ago

pubspec.yaml

name: pakpair description: A wedding app. publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.3.2+132

environment: sdk: ">=2.8.0 <3.0.0"

dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.2 provider: ^6.0.1 http: ^0.13.1 swipe_cards: ^0.1.0 shared_preferences: ^2.0.15 firebase_core: 2.4.1 firebase_auth: 4.2.5 google_sign_in: 5.4.4 url_launcher: 6.1.8 rflutter_alert: ^2.0.4 flutter_datetime_picker: ^1.5.0 webview_flutter: ^2.1.1 web_browser_detect: ^2.0.2 flushbar: ^1.10.4 device_info: ^2.0.0 flutter_easyloading: ^3.0.3 connectivity: ^3.0.6 permission_handler: ^10.2.0 path_provider: ^2.0.6 keyboard_actions: ^4.0.1 image_picker: ^0.8.4+4 firebase_crashlytics: 3.0.11 dropdown_date_picker: ^0.1.1+2 geolocator: 9.0.2 google_maps_flutter: 2.2.3 video_player: ^2.5.1 flutter_time_picker_spinner: ^2.0.0 flutter_calendar_carousel: ^2.0.3 flutter_switch: ^0.3.2 flutter_dropdown: ^1.0.0+hotfix.1 toggle_switch: ^1.3.0 day_picker: ^2.1.0 progress_indicators: ^1.0.0 flutter_rating_bar: ^4.0.0 sliding_up_panel: ^2.0.0+1 flutter_swiper: ^1.1.6 cached_network_image: ^3.0.0 flutter_map: ^2.2.0 latlong: ^0.6.1 google_place: ^0.4.3 syncfusion_flutter_datepicker: ^20.2.39 flutter_chat_bubble: ^1.0.2 remove_emoji: ^0.0.3 cloud_firestore: 4.3.1 firebase_storage: 11.0.10 intl_phone_number_input: ^0.7.0+2 flutter_facebook_auth: ^4.4.1+1 sign_in_with_apple: ^3.0.0 crypto: ^3.0.1 firebase_messaging: 14.2.1 overlay_support: ^1.2.1 flutter_local_notifications: ^9.1.5 video_trimmer: ^2.0.1 file_picker: ^4.3.0 reorderable_grid_view: ^2.2.2 photo_view: ^0.14.0 stop_watch_timer: ^1.3.1 pull_to_refresh: ^2.0.0 video_thumbnail: ^0.5.3 video_compress: ^3.1.0 country_state_city_picker: ^1.2.8 flutter_background_geolocation: ^4.11.0 image_cropper: ^1.5.0 flutter_slidable: ^1.2.0 flutter_native_timezone: ^2.0.0 purchases_flutter: ^3.9.5 flutter_countdown_timer: ^4.1.0 flutter_app_badger: ^1.4.0 connectycube_sdk: ^2.2.3 connectycube_flutter_call_kit: ^2.2.1 flutter_background: ^1.1.0 draggable_widget: ^2.0.0 liquid_progress_indicator: ^0.4.0 swipable_stack: ^2.0.0 internet_connection_checker: ^0.0.1+4 dropdown_search: ^5.0.2 safetynet_attestation: ^0.0.5 tutorial_coach_mark: 1.2.3 filter_list: ^1.0.2 audio_manager: ^0.8.2 get: ^4.6.5 animated_splash_screen: ^1.3.0 page_transition: ^2.0.9 google_fonts: ^3.0.1 lottie: ^1.4.3 font_awesome_flutter: ^10.2.1 voice_message_package: ^0.0.74 flutter_sound: ^9.2.13 record: ^4.4.3 gradient_like_css: ^1.0.1 sqflite: ^2.2.0+3 swipe_to: ^1.0.2 assets_audio_player: ^3.0.6 uni_links: ^0.5.1 holding_gesture: ^1.1.0 csc_picker: ^0.2.6 package_info_plus: ^1.0.6 cached_video_player: ^2.0.3 amplify_storage_s3: ^0.6.0 amplify_flutter: ^0.6.0 amplify_auth_cognito: ^0.6.0 amplitude_flutter: ^3.2.1 get_it: ^7.2.0 injectable: ^2.1.0 encrypt: ^5.0.1 profanity_filter: ^2.0.0 rate_my_app: ^1.1.3 flutter_linkify: ^5.0.2 new_version: ^0.3.1 percent_indicator: ^4.2.2 livechatt: ^1.4.0 intp_flutter_liveness_sdk: ^1.3.6

dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^1.0.0 flutter_launcher_icons: ^0.10.0

flutter_icons: android: true ios: true image_path: "assets/images/icon1024.png"

flutter: uses-material-design: true

To add assets to your application, add an assets section, like this:

assets:

android/build.gradle

buildscript { ext.kotlin_version = '1.6.10' ext { compileSdkVersion = 33 // or higher targetSdkVersion = 31 // or higher appCompatVersion = "1.0.2" // or higher playServicesLocationVersion = "17.0.0" // or higher } repositories { google() mavenCentral() }

dependencies {
    classpath 'com.android.tools.build:gradle:7.2.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.3.15'
}

}

allprojects { repositories { google() mavenCentral() maven { // [required] flutter_background_geolocation url "${project(':flutter_background_geolocation').projectDir}/libs" } maven { // [required] background_fetch url "${project(':background_fetch').projectDir}/libs" }

}

}

rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" project.evaluationDependsOn(':app') } subprojects { project.evaluationDependsOn(':app') }

task clean(type: Delete) { delete rootProject.buildDir }

christocracy commented 1 year ago

playServicesLocationVersion = “17.0.0”

set it to 21.0.1

17.0.0 is nearly 4 years old.

haidernaqvi87 commented 1 year ago

Thank you. I am new to flutter.

christocracy commented 1 year ago

When your issue is solved, please close this.

github-actions[bot] commented 4 weeks ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been inactive for 14 days since being marked as stale.