为属性“$4”指定的 Flutter (Barcode_scan) build\barcode_scan\extracted-protos\main' 不存在

Doa*_*Bui 1 barcode barcode-scanner flutter

我正在使用这个包来扫描二维码。但我升级到3.x版本,出现错误:

[   +2 ms] FAILURE: Build failed with an exception.
[   +2 ms] * What went wrong:
[        ] Some problems were found with the configuration of task ':barcode_scan:generateDebugProto'.
[        ] > Directory '<projectName>\build\barcode_scan\extracted-protos\main' specified for property '$4' does not exist.
[  +19 ms] * Try:
[  +17 ms] 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.
Run Code Online (Sandbox Code Playgroud)

我尝试添加main文件夹,extracted-protos但当我运行应用程序时,该文件夹丢失。

Doa*_*Bui 7

花了2天时间尝试修复它。最后我想出了如何:

转到android文件夹>build.gradle文件。添加行后:

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

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12' //add this line
  }
}
Run Code Online (Sandbox Code Playgroud)

它起作用了。