Skip to content Skip to sidebar Skip to footer

Fabric With Android Studio

I'm trying to install Crashlytics trough Fabric into my Android Studio Project I'm running into the following error: Gradle tasks [:App:generateDebugSources, :App:generateDebugAndr

Solution 1:

Have two build.gradle In first of the project/build.gradle add:

buildscript {
    repositories {
      //ADD this Line
      maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        //ADD this Line
        classpath 'io.fabric.tools:gradle:1.22.2'
    }
 }

And in second app/build.gradle

buildscript {
    repositories {
      //ADD this Line
      maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        //ADD this Line
        classpath 'io.fabric.tools:gradle:1.22.2'
    }
 }

 apply plugin: 'io.fabric'

 repositories {
      maven { url 'https://maven.fabric.io/public' }
 }
 dependencies {
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar'){
         transitive = true;
    }
 }

AndroidManifest

<uses-permissionandroid:name="android.permission.INTERNET" /><application
    <meta-dataandroid:name="io.fabric.ApiKey"android:value="yourKey" /><application/>

MainActivity

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_main);
}

Solution 2:

Change this part, adding the @aar notation

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

In this way you will download the aar artifact from the repo.

Solution 3:

One mistake you did is that you have added meta-data inside of activity.

it should be outside of <activity tag and inside of <application tag

And make sure you have initialize fabrics once in Application or Activity startUp.

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

Post a Comment for "Fabric With Android Studio"