简体   繁体   English

由于 firebase-analytics 导致 Gradle 失败

[英]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 :您可以在FlutterFirebase 文档中进一步阅读:

dependencies:
  firebase_analytics: ^5.0.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法解析:com.google.firebase:firebase-analytics:19.0.0 - Failed to resolve: com.google.firebase:firebase-analytics:19.0.0 清单合并失败依赖于 com.google.firebase:firebase-analytics:17.2.2 - Manifest merger failed on dependency com.google.firebase:firebase-analytics:17.2.2 对Firebase Analytics使用“com.google.firebase:firebase-analytics”? - Use 'com.google.firebase:firebase-analytics' for Firebase Analytics? 如何从 Google-Analytics 迁移到 Firebase-Analytics? - How to move from Google-Analytics to Firebase-Analytics? firebase-core和firebase-analytics libraray有什么区别? - What the difference in firebase-core and firebase-analytics libraray? 找不到 com.google.firebase:firebase-analytics: - Could not find com.google.firebase:firebase-analytics: “找不到 com.google.firebase:firebase 分析” - "Could not find com.google.firebase:firebase-analytics" BigQuery使用firebase-analytics事件获取错误 - BigQuery using firebase-analytics events getting error 实施 firebase-analytics 和 play-services-analytics 后 Google Play 中的广告警告 - Ads warning in Google Play after implementing firebase-analytics and play-services-analytics 其他各种库都在请求库com.google.firebase:firebase-analytics - The library com.google.firebase:firebase-analytics is being requested by various other libraries
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM