Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails in Flutter 3.0.0 #150

Closed
ItsWajdy opened this issue May 13, 2022 · 30 comments
Closed

Build fails in Flutter 3.0.0 #150

ItsWajdy opened this issue May 13, 2022 · 30 comments

Comments

@ItsWajdy
Copy link

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
Copy link

ozz-rjq commented May 17, 2022

same issue, possible to fix?

@ItsWajdy
Copy link
Author

@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
Copy link
Contributor

hilalbaig commented May 18, 2022

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

please share your pubspec.yaml file

@LuisDeLaValie
Copy link

imagen

please share your pubspec.yaml file

@santhoshrao519
Copy link

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

This comment was marked as duplicate.

@santhoshrao519
Copy link

@XuanTung95 please check

image

@XuanTung95

This comment was marked as duplicate.

@santhoshrao519
Copy link

@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:
- assets/
- assets/env/

@XuanTung95

This comment was marked as duplicate.

@santhoshrao519
Copy link

pubspec file.txt

@XuanTung95

This comment was marked as duplicate.

@santhoshrao519
Copy link

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

@XuanTung95

This comment was marked as duplicate.

@santhoshrao519
Copy link

pubspec file.txt

@XuanTung95
Copy link

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
Copy link

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

@santhoshrao519
Copy link

anyone fixed the issue, please respond

@XuanTung95
Copy link

anyone fixed the issue, please respond

Leave your email here, I will mail you.

@santhoshrao519
Copy link

please mail me @ [email protected]

@sisalik1
Copy link

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
Copy link

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
Copy link
Owner

fixed in #151

@sisalik1
Copy link

Still having this issue: #152

@mrLorick
Copy link

mrLorick commented Aug 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants