Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to apply 'io.fabric' plugin on Android

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

like image 372
Danylo Oliinyk Avatar asked May 25 '18 13:05

Danylo Oliinyk


3 Answers

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

like image 102
RileyManda Avatar answered Nov 18 '22 00:11

RileyManda


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.

like image 5
Fabian Baez Avatar answered Nov 18 '22 02:11

Fabian Baez


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'
like image 1
Dennis Avatar answered Nov 18 '22 02:11

Dennis