Failed to apply 'io.fabric' plugin on Android
Asked Answered
S

3

7

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

Schwartz answered 25/5, 2018 at 13:26 Comment(3)
post your build.gradle pleaseIncorporated
and your gradle and android gradle plugin versionsIncorporated
added project-level and app-level gradle files, mentioned gradle versionsSchwartz
T
17

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

Taneka answered 29/5, 2018 at 20:25 Comment(0)
B
5

I had exactly the same problem. The error is generated due to the extra property "crashlytics" in the project-level build.gradle, which generates a conflict.

Simply change the extra property "crashlitycs" to "crashlyticsVersion" or something similar and the error disappears.

I also recommend that you use the suffix "Version" in the extra properties to avoid similar errors.

Bluebonnet answered 26/10, 2018 at 18:55 Comment(1)
thank you very much, you saved me hours, I'm wondering how fragile gradle is, how is it possible to "override" a propery :/Lattonia
T
1

In your project gradle you should put

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

Meanwhile in the app gradle file in the top

apply plugin: 'io.fabric'

and as dependencies

implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
Taperecord answered 25/5, 2018 at 13:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.