简体   繁体   中英

Problem in using firebase crashlytics sdk

I want to use of firebase crashlytics sdk base on official document and i got this gradle sync failed:

ERROR: Android dependency 'com.crashlytics.sdk.android:crashlytics-core:2.4.1' is set to compileOnly/provided which is not supported

What can i do for solving this problem...?

app level:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'


    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    // Add dependency
    implementation  'com.crashlytics.sdk.android:crashlytics:2.10.1'

}

apply plugin: 'com.google.gms.google-services'

project level:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }

        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
        classpath 'com.google.gms:google-services:4.3.2'
        classpath 'io.fabric.tools:gradle:1.31.0'  // Crashlytics plugin

    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        maven {
            url 'https://maven.google.com/'
        }
        maven {
            url 'https://maven.fabric.io/public'
        }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

compileOnly is the replacement — the equivalent configuration that is being deprecated is provided . See the documentation .

In your project-level build.gradle, update your google-services to version 3.1.2 or later, then add the Crashlytics repositories and dependency:

  buildscript {
  repositories {
    // Add the following repositories:
    google()  // Google's Maven repository

    maven {
       url 'https://maven.fabric.io/public'
    }
}

dependencies {
    // ...

    // Check for v3.1.2 or higher
    classpath 'com.google.gms:google-services:4.3.2'  // Google Services plugin

    // Add dependency
    classpath 'io.fabric.tools:gradle:1.31.0'  // Crashlytics plugin

   }
  }


 allprojects {
   // ...

  repositories {
   // Check that you have the following line (if not, add it):
   google()  // Google's Maven repository
   // ...
  }
 }

In your app-level build.gradle, add the Crashlytics dependencies:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

dependencies {
// ...

// (Recommended) Add Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.0'

// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM