简体   繁体   中英

I am getting errors while trying to build my flutter project in android studio

When I try to run my flutter application, I get the error below. What could be the cause? ......................................................................................................................................................................................................................................................................................................................................................................................................................

I am using qr_code_scanner: ^0.5.2 ,

      Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Parameter format not correct -
e: C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\qr_code_scanner-0.7.0\android\src\main\kotlin\net\touchcapture\qr\flutterqr\QRView.kt: (23, 1): Class 'QRView' 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:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\qr_code_scanner-0.7.0\android\src\main\kotlin\net\touchcapture\qr\flutterqr\QRView.kt: (216, 26): Null can not be a value of a non-null type String
e: C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\qr_code_scanner-0.7.0\android\src\main\kotlin\net\touchcapture\qr\flutterqr\QRView.kt: (247, 26): Null can not be a value of a non-null type String
e: C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\qr_code_scanner-0.7.0\android\src\main\kotlin\net\touchcapture\qr\flutterqr\QRView.kt: (310, 5): 'onRequestPermissionsResult' overrides nothing
e: C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\qr_code_scanner-0.7.0\android\src\main\kotlin\net\touchcapture\qr\flutterqr\QRViewFactory.kt: (10, 1): Class 'QRViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory
e: C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\qr_code_scanner-0.7.0\android\src\main\kotlin\net\touchcapture\qr\flutterqr\QRViewFactory.kt: (13, 5): 'create' overrides nothing

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':qr_code_scanner: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 51s
Exception: Gradle task assembleDebug failed with exit code 1

My pubspec.yaml

name: StarMe
description: A Social Media Project.
publish_to: "none"
version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.3
  google_fonts: ^2.1.0
  flutter_icons_nullsafty: ^1.0.0
  http: ^0.13.3
  cached_network_image: ^3.1.0
  encrypt: ^5.0.1
  flutter_svg: ^0.22.0
  qr_flutter: ^4.0.0
  clipboard: ^0.1.3
  share: ^2.0.4
  qr_code_scanner: ^0.7.0
  fluro: ^2.0.3
  url_launcher: ^6.0.10
  image_picker: ^0.8.4
  country_code_picker: ^2.0.2
  introduction_screen: ^2.1.0
  pin_code_fields: ^7.3.0
  provider: ^6.0.0
  hive: ^2.0.4
  hive_flutter: ^1.1.0
  flutter_secure_storage: ^4.2.1
  local_auth: ^1.1.7
  permission_handler: ^8.1.4+2
  fl_chart: ^0.40.0
  carousel_slider: ^4.0.0
  web3dart: ^2.3.1
  device_info_plus: ^2.1.0
  package_info_plus: ^1.3.0
  intl: ^0.17.0
  flutter_paystack:
    git:
      url: https://github.com/definitelyme/flutter_paystack.git
      ref: a4a33c3dd0a12f46d655a2e63d11e9f20ba82d01

  flutter_braintree: ^2.0.0+1
  loading_overlay: ^0.3.0
  lazy_load_scrollview: ^1.3.0
  shimmer: ^2.0.0
  in_app_review: ^2.0.3
  image_cropper: ^1.5.0
  ntp: ^2.0.0
  uuid: ^3.0.4
  cron: ^0.3.2
  dotted_border: ^2.0.0+1
  translator: ^0.1.7

  firebase_core: ^1.6.0
  
  firebase_messaging: ^10.0.9
  firebase_analytics: ^8.3.4
  firebase_dynamic_links: ^3.0.1

  easy_localization_loader: ^1.0.0
  
  sentry_flutter: ^6.0.1
  twilio_phone_verify: ^2.0.0
  flutter_local_notifications: ^9.0.1
  flutter_dotenv: ^5.0.2


  flutter_localizations:
    sdk: flutter

dev_dependencies:
  flutter_test:
    sdk: flutter

Use alternative mobile_scanner . this library doesn't work in Flutter 3.0. or else if you want to use qr_code_scanner library, that is not the official creator repo but you can use it.

dependency_overrides:
    qr_code_scanner:
        git:
            url: https://github.com/X-SLAYER/qr_code_scanner.git
            ref: flutter-beta

Instead of giving qr_code_scanner: ^0.5.2 try qr_code_scanner: any . This is just a workaround. It will fetch a relevant version of QR scanner automatically. If it doesn't work try flutter clean and then flutter run

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM