I've been trying to add Crashlytics to an app I'm developing on Android Studio 1.1.0 with no luck. I've added the Fabric plugin to Android Studio and when adding my app, the Crashlytics library is not recognized.
Here is the code added by Fabric:
...
import com.crashlytics.android.Crashlytics; // Error here
import io.fabric.sdk.android.Fabric; // Error here
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics()); // Error here
setContentView(R.layout.activity_main);
...
}
And here are the errors:
C:\Workspace\Projects\AndroidG\Borgertip\borgertip\src\main\java\dk\gis34\borgertip\activity\MainActivity.java
Error:(12, 31) error: package com.crashlytics.android does not exist
Error:(16, 29) error: package io.fabric.sdk.android does not exist
Error:(67, 31) error: cannot find symbol class Crashlytics
Error:(67, 9) error: cannot find symbol variable Fabric
Can a kind soul figur out why this doesn't just work, like it does on Eclipse?
You should have these lines in your build.gradle file:
dependencies {
// ...
compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {
transitive = true;
}
}
and this
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// ...
classpath 'io.fabric.tools:gradle:1.14.3'
}
}
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