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:
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.
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. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With