简体   繁体   中英

Flutter package barcode_scan -> Failed to notify project evaluation listener

After migrating my project to Androidx, i've got a build error because of the barcode_scan library.

I tried two Kotline Versions. Both 1.2.31 and 1.2.51 don't work.

    dependencies:
        flutter:
            sdk: flutter
        firebase_auth: any
        firebase_messaging: any
        flutter_html: any
        http: any
        intl: any
        cloud_firestore: any
        url_launcher: any
        share: any
        expandable: any
        qr_flutter: any
        qrcode_reader: any
        random_string: any
        barcode_scan: ^1.0.0

My buildscript in the project-level gradle file locks like this

buildscript {
    ext.kotlin_version = '1.2.31'
    repositories {
        google()
        jcenter()
    }

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

    }
}

Error running Gradle: ProcessException: Process "C:\\Users\\davidw\\OneDrive - BBBaden\\Anlagen\\Pfadi\\App\\dev\\morea-master\\android\\gradlew.bat" exited abnormally:

Configure project :app registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':barcode_scan'.

    Failed to notify project evaluation listener. java.lang.AbstractMethodError (no error message)

I don't exactly know why, and hopefully someone more experienced will comment on this, but I solved this exact problem by commenting this line out from my app-level gradle:

implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

And changing the Kotlin version & Gradle version in the project-level gradle to:

ext.kotlin_version = '1.3.10'

classpath 'com.android.tools.build:gradle:3.3.0'

I'm still getting registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) , but the app builds.

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