Almoullim / background_location

Flutter background location plugin for Android and iOS
https://pub.dev/packages/background_location
Other
224 stars 236 forks source link

Build fails in Flutter 3.0.0 #150

Closed ItsWajdy closed 2 years ago

ItsWajdy commented 2 years ago

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.0, on Microsoft Windows [Version 10.0.22000.675], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.2)
[√] IntelliJ IDEA Community Edition (version 2021.1)
[√] VS Code (version 1.66.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

pubspec.yaml:

dependencies:
    background_location: ^0.8.1

Problem: When trying to build my app I am getting an error related to this library. The error in details follows

e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\background_location-0.8.1\android\src\main\kotlin\com\almoullim\background_location\BackgroundLocationService.kt: (23, 1): Class 'BackgroundLocationService' is not abstract and does not implement abstract member public abstract fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): Boolean defined in io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\background_location-0.8.1\android\src\main\kotlin\com\almoullim\background_location\BackgroundLocationService.kt: (221, 5): 'onRequestPermissionsResult' overrides nothing

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':background_location:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 33s
Exception: Gradle task assembleDebug failed with exit code 1
ozz-rjq commented 2 years ago

same issue, possible to fix?

ItsWajdy commented 2 years ago

@ozz-rjq As far as I know, the only way to fix this right now is to downgrade flutter. You can run flutter downgrade 2.10.5 and then build your application.

hilalbaig commented 2 years ago

Fix, update BackgroundLocationService.kt

Change override fun onRequestPermissionsResult(requestCode: Int, permissions: Array?, grantResults: IntArray?): Boolean

to

override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray): Boolean

The issue has been fixed in pull request #151

muhamadkhuram commented 2 years ago

Fix, update BackgroundLocationService.kt

Change override fun onRequestPermissionsResult(requestCode: Int, permissions: Array?, grantResults: IntArray?): Boolean

to

override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray): Boolean

The issue has been fixed in pull request #151

how can I install the package with the code you have pushed. Please guide me here.

LuisDeLaValie commented 2 years ago

Fix, update BackgroundLocationService.kt Change override fun onRequestPermissionsResult(requestCode: Int, permissions: Array?, grantResults: IntArray?): Boolean to override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray): Boolean The issue has been fixed in pull request #151

how can I install the package with the code you have pushed. Please guide me here.

use this

background_location: 
    git:
      url: https://github.com/hilalbaig/background_location.git
      ref: master
santhoshrao519 commented 2 years ago

Fix, update BackgroundLocationService.kt Change override fun onRequestPermissionsResult(requestCode: Int, permissions: Array?, grantResults: IntArray?): Boolean to override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray): Boolean The issue has been fixed in pull request #151

how can I install the package with the code you have pushed. Please guide me here.

use this

background_location: 
    git:
      url: https://github.com/hilalbaig/background_location.git
      ref: master

getting Could not find a file named "pubspec.yaml" in https://github.com/hilalbaig/background_location.git, please check

XuanTung95 commented 2 years ago

Fix, update BackgroundLocationService.kt Change override fun onRequestPermissionsResult(requestCode: Int, permissions: Array?, grantResults: IntArray?): Boolean to override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray): Boolean The issue has been fixed in pull request #151

how can I install the package with the code you have pushed. Please guide me here.

use this

background_location: 
    git:
      url: https://github.com/hilalbaig/background_location.git
      ref: master

getting Could not find a file named "pubspec.yaml" in https://github.com/hilalbaig/background_location.git, please check

It works for me. I think your pubspec.yaml is wrong.

santhoshrao519 commented 2 years ago

please share your pubspec.yaml file

LuisDeLaValie commented 2 years ago

imagen

please share your pubspec.yaml file

santhoshrao519 commented 2 years ago

Firstly, thanks for sharing . I have followed above code but throwing Could not find a file named "pubspec.yaml" in https://github.com/hilalbaig/background_location.git 0206658d90352b7c6341fc44bb037e92968aba64. pub get failed (1; Could not find a file named "pubspec.yaml" in https://github.com/hilalbaig/background_location.git 0206658d90352b7c6341fc44bb037e92968aba64.)

XuanTung95 commented 2 years ago

@santhoshrao519 Dude, just post your pubspec.yaml here

santhoshrao519 commented 2 years ago

@XuanTung95 please check

image

XuanTung95 commented 2 years ago

@santhoshrao519

Could you upload the pubspec.yaml file here so I can run it in my pc?

santhoshrao519 commented 2 years ago

@XuanTung95 please check

name: sdlabs_technician_app description: Flutter App for SD Labs Technician publish_to: 'none' version: 1.0.0+1

environment: sdk: ">=2.12.0 <3.0.0"

dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.2 provider: ^5.0.0 shared_preferences: ^2.0.6 hexcolor: ^2.0.5 http: ^0.13.3 flutter_svg: ^0.22.0 maps_launcher: ^2.0.1 intl: ^0.17.0 flutter_launcher_icons: ^0.9.2 dotted_line: ^3.0.1 geolocator: ^7.6.2 pull_to_refresh: ^2.0.0 geocoding: ^2.0.1 url_launcher: ^6.0.12 simple_connection_checker: ^0.2.1 get: ^4.3.8 image_picker: ^0.8.3+2 camera: ^0.9.4+3 path_provider: ^2.0.5 path: ^1.8.0 flutter_switch: ^0.3.2 pinput: ^2.1.0 flutter_barcode_scanner: ^2.0.0 background_location: ^0.8.1 flutter_polyline_points: ^1.0.0 google_maps_flutter: ^2.1.0 location: ^4.3.0 geofence_service: ^3.4.1 awesome_notifications: ^0.6.14 exif: ^3.0.1 firebase_core: ^1.6.0 firebase_analytics: ^5.0.2 firebase_messaging: ^11.2.0 flutter_local_notifications: ^9.1.3 permission_handler: ^8.1.0 flutter_rating_bar: ^4.0.0

dependency_overrides: firebase_messaging_platform_interface: 3.1.6

flutter_icons: android: "launcher_icon" ios: true image_path: "assets/sdlab.png"

dev_dependencies: flutter_test: sdk: flutter

flutter:

uses-material-design: true

fonts:

- family: Roboto
  fonts:
    - asset: fonts/Roboto-Black.ttf
    - asset: fonts/Roboto-Bold.ttf
    - asset: fonts/Roboto-Light.ttf
    - asset: fonts/Roboto-Medium.ttf
    - asset: fonts/Roboto-Regular.ttf

assets:

XuanTung95 commented 2 years ago

@santhoshrao519 I cannot copy and run if you paste like that because the space is wrong. Please click on Attach files by dragging & dropping, selecting or pasting them. and upload the file in your comment.

santhoshrao519 commented 2 years ago

pubspec file.txt

XuanTung95 commented 2 years ago

pubspec file.txt

There is no problem for this file... Because it still use the version from pub.dev

  flutter_barcode_scanner: ^2.0.0
  background_location: ^0.8.1
  flutter_polyline_points: ^1.0.0
santhoshrao519 commented 2 years ago

@XuanTung95 please replace background_location: git: url: https://github.com/hilalbaig/background_location.git ref: master

XuanTung95 commented 2 years ago

@XuanTung95 please replace background_location: git: url: https://github.com/hilalbaig/background_location.git ref: master

Please send me your file with the custom git repo so I can see what's wrong with it. There is no point for me to replace it in my side because I already success to do it.

santhoshrao519 commented 2 years ago

pubspec file.txt

XuanTung95 commented 2 years ago

This file is OK too. If you got the error when running 'flutter pub get' I doubt that it's because the package conflict with the old one. Please try this SO update-flutter-dependencies-in-pub-cache

santhoshrao519 commented 2 years ago

I have run flutter pub cache repair & flutter pub cache clean commands, but still getting the same issue

santhoshrao519 commented 2 years ago

anyone fixed the issue, please respond

XuanTung95 commented 2 years ago

anyone fixed the issue, please respond

Leave your email here, I will mail you.

santhoshrao519 commented 2 years ago

please mail me @ santhumittapally@gmail.com

sisalik1 commented 2 years ago

Without this workaround code it fails. Is this fix going to be in the next update?

background_location: git: url: https://github.com/hilalbaig/background_location.git ref: master

XuanTung95 commented 2 years ago

After fixing build error, this plugin still doesn't work for me on Android. And it's not been maintained for a long time. So I used geolocator plugin instead.

Almoullim commented 2 years ago

fixed in https://github.com/Almoullim/background_location/pull/151

sisalik1 commented 1 year ago

Still having this issue: https://github.com/Almoullim/background_location/issues/152

mrLorick commented 2 months ago

Hello Developers..

Caused by: java.lang.SecurityException: com.dulb.solid_waste_management: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts Getting this error Target sdk 34

33 Working Fine

Both try bt Not working Please Help

background_location: ^0.11.8

background_location: git: url: https://github.com/hilalbaig/background_location.git ref: master