Search code examples
androidcrashlyticsgoogle-fabric

error: cannot find symbol class Crashlytics and Fabric


I'm following Fabric official documentation to add crashlytic, I had successfully added everything in gradle.build file but now when I'm trying to write Fabric.with(this, new Crashlytics()); it says :

 Error:(163, 31) error: cannot find symbol class Crashlytics
Error:(163, 9) error: cannot find symbol variable Fabric
Error:Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

this is my gradle.build file

....
apply plugin: 'io.fabric'

buildscript {
ext.kotlin_version = '1.1.51'
repositories {
    jcenter()
    mavenCentral()
    maven {
        url 'https://maven.google.com'
    }
    maven { url 'https://maven.fabric.io/public' }

}
dependencies {
    ....
    classpath 'io.fabric.tools:gradle:1.24.3'

    }
}

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

}

android {

compileSdkVersion 22

buildToolsVersion '25.0.3'
defaultConfig {
    applicationId "com.example.com"
    ....
}

}
dependencies {
......
   compile('com.crashlytics.sdk.android:crashlytics:2.7.0@aar') {
    transitive = true
  }
}

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

Also tried clean project/ rebuild and e.t.c but same problem every time


Solution

  • fixed ! it was the Android Studio's fault.

    Solution:

    File-> invalidate caches / restart

    after that everything worked perfectly