[英]Failed Gradle because of firebase-analytics
I followed the instructions for adding an Android app to Firebase project but when i run the code it gives me the following error:我按照将 Android 应用程序添加到 Firebase 项目的说明进行操作,但是当我运行代码时,出现以下错误:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not find com.google.firebase:firebase-analytics:.
Required by:
project :app
How can I solve?我该如何解决? I just copy and paste from the offcial Firebase documentation and I'm using Flutter.
我只是从官方 Firebase 文档中复制和粘贴,我正在使用 Flutter。
app/build.gradle应用程序/build.gradle
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation 'com.google.firebase:firebase-analytics'
...
}
android/build.gradle android/build.gradle
dependencies{
classpath 'com.google.gms:google-services:4.3.4'
...
}
You need to have a version number specified for the dependency.您需要为依赖项指定一个版本号。 You can find the latest version in the release notes .
您可以在发行说明中找到最新版本。
implementation 'com.google.firebase:firebase-analytics:17.5.0'
But since you tagged this question with Flutter, if you are building a Flutter app, you should probably instead follow the instructions in the documentation .但是因为你用 Flutter 标记了这个问题,如果你正在构建一个 Flutter 应用程序,你可能应该按照文档中的说明进行操作。
To use this plugin, add firebase_analytics as a dependency in your pubspec.yaml file.
要使用此插件,请在 pubspec.yaml文件中添加firebase_analytics作为依赖项。 You must also configure firebase analytics for each platform project: Android and iOS (see the example folder or https://codelabs.developers.google.com/codelabs/flutter-firebase/#6 for step by step details).
您还必须为每个平台项目配置 Firebase 分析:Android 和 iOS(请参阅示例文件夹或https://codelabs.developers.google.com/codelabs/flutter-firebase/#6以获取分步详细信息)。
You can read further in the Firebase documentation for Flutter :您可以在Flutter的Firebase 文档中进一步阅读:
dependencies:
firebase_analytics: ^5.0.2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.