1

I am getting error while adding Firebase Crashlytics in Android project. I have checked all the solution provided in Stack Overflow but it didn't work out.

build gradle (project)

buildscript {
   repositories {
       google()
   }
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.4.2'
    classpath 'com.google.gms:google-services:4.3.3'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta01'
}

allprojects {
   repositories {
      google()
   }
}

build gradle (app)

apply plugin: 'com.google.firebase.crashlytics'

dependencies {
   //Recommended: Firebase SDK for Google Analytics.
   implementation 'com.google.firebase:firebase-analytics:17.2.2'
   //Firebase SDK for Crashlytics.
   implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
}

Error:

Execution failed for task ':app:preDebugBuild'.

Android dependency 'com.google.android.gms:play-services-measurement-base:17.2.2' is set to compileOnly/provide which is not supported

When I remove the Firebase Analytics and then sync it works properly with no issues.

halfer
  • 19,824
  • 17
  • 99
  • 186
Atul Dhanuka
  • 1,453
  • 5
  • 20
  • 56
  • At the beginning of the post, you mention that you're getting the error "while adding Firebase crashlytics," and then later you say that when you "remove the Firebase analytics" it works without issue. Which have you added first, and what is the behavior when you test building with just Crashlytics, just Analytics, and both Crashlytics + Analytics? – Kevin Kokomani Jan 21 '20 at 20:59
  • @KevinKokomani As per document i have added both library after if i put only Crashlytics project is running fine, if i put only Analytics i am getting error and if i put both then also i my getting error. – Atul Dhanuka Jan 22 '20 at 05:16
  • What version of Gradle are you using? I have not been able to reproduce this issue so far, so it seems that the problem lies in some combination of Analytics + your configuration. Check this out as it seems related: https://stackoverflow.com/questions/49888772/android-dependency-is-set-to-compileonly-provided-which-is-not-supported – Kevin Kokomani Jan 23 '20 at 16:14

1 Answers1

0
implementation 'com.google.firebase:firebase-analytics:17.0.0'

Try to implent this, and change your project structure bro