尝试在带有 Cordova 12.0.0 的 Ionic 7.1.1 项目中使用 @awesome-cordova-plugins/barcode-scanner/ngx 库时遇到问题。当我为Android平台构建项目时,出现以下错误:
/platforms/android/phonegap-plugin-barcodescanner/starter-barcodescanner.gradle' line: 9[cordova][cordova] * What went wrong:[cordova] A problem occurred evaluating script.[cordova] > Could not find method compile() for arguments [{name=barcodescanner-release-2.1.5, ext=aar}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
我检查了我的依赖项的版本,它们如下:
Ionic: 7.1.1
Cordova: 12.0.0 ([email protected])
Node.js: v16.20.2
我在这个插件的另一个版本上也遇到了类似的错误。 我通过将“编译”更改为“实现”来解决它,就像那样
dependencies {
implementation(name:'barcodescanner-release-2.1.5', ext:'aar')
}
在文件/plugins/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle