我遇到了这个错误,请您告诉我解决方法是什么。它显示无法从缓存中加载构建文件 'C:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_database-6.0.0\android\build.gradle' 的编译类。我不确定是什么导致了错误,因为我的所有依赖项都是最新版本。
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':firebase_database'.
> Could not load compiled classes for build file 'C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_database-6.0.0\android\build.gradle' from cache.
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':firebase_database' of type org.gradle.api.Project.
> Could not find method implementation() for arguments [project ':firebase_core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
这些是我项目中 pubspec.yaml 文件的依赖项。
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.7.0
firebase_auth: ^0.20.0
fluttertoast: ^7.1.8
google_maps_flutter: ^2.0.1
firebase_database: ^6.0.0
geolocator: ^6.1.1
http:
provider: ^5.0.0
答案 0 :(得分:0)
在项目级别的 build.gradle 添加:
classpath 'com.google.gms:google-services:4.3.5'
并在应用级 build.gradle 添加:
apply plugin: 'com.google.gms.google-services'
//above the dependencies tag