0
votes

I am facing a strange error in my project. I tried solutions to similar questions but they did not work. I and my coworker tried to update the barcodescan but nothing changed.

Here is the error message.

Launching lib/main.dart on Android SDK built for x86 in debug mode... Running Gradle task 'assembleDebug'...

**FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
project ':barcode_scan' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51

* 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

BUİLD FAILED in 978ms
Exception: Gradle task assembleDebug failed with exit code 1

This is my android/build.gradle file

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        //classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51"
    }
}
allprojects {
    repositories {
        google()
        jcenter()
    }
}
rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

And finally my pubspec.yaml file

name: myapp
description: A new Flutter project.

version: 1.0.0+1


environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  flutter_datetime_picker: ^1.3.7
  cupertino_icons: ^0.1.0
  barcode_scan: ^0.0.4
  intl: ^0.15.7
  sqflite: any
  path_provider: any
  http: any
  json_serializable: ^2.2.1
  json_annotation: ^2.2.0
  build_runner: ^1.3.3
  image_picker: 0.4.12+1  
  mime: ^0.9.6+3 
  toast: ^0.1.5 
  loading: ^1.0.2
  progress_dialog: ^1.2.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_launcher_icons: "^0.7.0"

flutter_icons:
  android: true
  ios: true
  image_path_ios: "assets/launch_logo.jpg"
  image_path_android: "assets/launch_logo.jpg"

flutter:
  uses-material-design: true

  assets:
    - assets/

module:
  androidX: true # Add this line.
2

2 Answers

0
votes

Try to update barcode_scan to the latest version: https://pub.dev/packages/barcode_scan

0
votes

I found how to solve my problem it as all about versions when I downgrade my flutter version to 1.2.1 everything works fine, there are many 3rd party plugin my project like barcode reader or date time picker and some of them works with an older version of flutter and they do not support the latest version of the flutter that's why I needed to downgrade my flutter to 1.2.1.