Failed to apply 'io.fabric' plugin on Android

Danylo Oliinyk picture Danylo Oliinyk · May 25, 2018 · Viewed 10.3k times · Source

I'm trying to add Firebase Crashlytics. Firebase Crashlytics tutorial is very simple: https://firebase.google.com/docs/crashlytics/get-started?authuser=0

I've already added repositories (in buildscript and in all projects), as well as classpath and implementation of dependency. All just like in the tutorial. But when I applying 'io.fabric' plugin (apply plugin: 'io.fabric') and pressing 'Sync' in Android Studio - next error is shown:

A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'io.fabric']
   > No such property: verboseGradlePlugin for class: java.lang.String

I'm applying plugin after "apply plugin: 'com.android.application'".
Tried to add Fabric plugin to Android Studio - didn't help.
Tried all plugin versions down to 1.24.0. (Current is 1.25.4)
Invalidated caches and restarted Android Studio.
Tried to add 'fabric.properties' file to app folder as well as 'crashlytics.properties' file.
Tried to pass -DverboseGradlePlugin=false or with 'true' to gradle's 'build' task.

Gradle knows about 'io.fabric' plugin, but trying to find 'verboseGradlePlugin' property that is missing. I haven't found any info about such issue in the google.

Maybe someone already faced the same problem or have any suggestions how to solve this?

UPD:
My project-level build.gradle
My app-level build.gradle

Gradle version - 4.4
Android gradle plugin version - 3.1.2

Answer

RileyManda picture RileyManda · May 29, 2018

Step1: In your project level build.gradle add:

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

NB:This addition should strictly be pasted inside your buildscript and not your allprojects gradle script as follows:

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

Next,add your io.fabric tools into your dependencies in the same gradle(build.gradle)

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.google.gms:google-services:3.2.1'
    classpath 'io.fabric.tools:gradle:1.25.4'
}

As soon as this is done,Sync your gradle before moving onto the next step.You should have something like this for step1 Step1

Step2:In your app level build.gradle add

apply plugin: 'io.fabric'

And in your dependencies:

dependencies {
// ...
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'

}

Now Sync again and Rebuild and Run your project.

NB:Sync right after manipulating the project level build.gradle before manipulating your app level.

More details here