Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build error after migrating from Crashlytics SDK to Fabric

Recently, we've upgraded our organization's Crashlytics account to Fabric, and I'm trying to replace the old Crashlytics SDK with the new Fabric SDK in our existing apps. I've followed the migration instructions, and it's been largely painless, except that I'm now receiving a build error when I try to compile. The line in question that's causing the error is the bootstrap call:

Fabric.with(this, new Crashlytics());

The error that's being returned is:

Error:(55, 11) error: no suitable method found for with(MyActivity,Crashlytics)
method Fabric.with(Fabric) is not applicable
(actual and formal argument lists differ in length)
method Fabric.with(Context,Kit...) is not applicable
(argument type Crashlytics does not conform to vararg element type Kit)

Evidently, new Crashlytics() isn't being recognized as a valid argument for the with(Context,Kit...) method for some reason.

Just to rule out something specifically related to the vararg nature of the method call, I also tried it with more than one kit (e.g. Fabric.with(this, new Crashlytics(), new MoPub())) and the exact same error was still returned.

Finally, I tried moving the call to the onCreate() method of my Application subclass, and that didn't help either.


Relevant sections from build.gradle:

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

  dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
  }
}

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

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

dependencies {
  compile fileTree(dir: 'libs', include: '*.jar')
  ...
  compile('com.crashlytics.sdk.android:crashlytics:2.2.1@aar') {
    transitive = true;
  }
}

I've also verified that the Fabric plugin is properly installed and working, and that the old Crashlytics plugin is no longer installed:

Plugins list shown Fabric plugin present, and Crashlytics plugin not presentFabric plugin running

like image 440
CloudyMusic Avatar asked Feb 24 '15 17:02

CloudyMusic


2 Answers

I found exactly what @TreKing mentioned in his comment. The upgrade/migration failed to remove the previous dependency from my app/build.gradle file. Look for an old entry like compile 'com.crashlytics.android:crashlytics:1.1.13' and remove it.

like image 71
Bill Mote Avatar answered Oct 18 '22 20:10

Bill Mote


It turns out that the old Crashlytics JAR was still hiding in my libs folder somehow, and after removing it, this error no longer persists.

I feel a little boneheaded, but I'll leave this up to help any future Googlers who run into the same issue. :)

like image 26
CloudyMusic Avatar answered Oct 18 '22 22:10

CloudyMusic