euler4533
euler4533

Reputation: 3

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:

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.

app/build.gradle

apply plugin: 'com.google.gms.google-services'
dependencies {
    implementation 'com.google.firebase:firebase-analytics'
    ...
}

android/build.gradle

dependencies{
  classpath 'com.google.gms:google-services:4.3.4'
  ...
}

Upvotes: 0

Views: 822

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317562

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.

To use this plugin, add firebase_analytics as a dependency in your pubspec.yaml file. 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).

You can read further in the Firebase documentation for Flutter:

dependencies:
  firebase_analytics: ^5.0.2

Upvotes: 1

Related Questions