Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add firebase crashlytics into android projects

Tags:

In my application, I want to use firebase Crashlytics and for this, I added below codes into my application.
I added this codes step by step from google document!
I added below codes but when sync application show me an error and not sync project.

Build.gradle (project) :

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'
        classpath 'io.fabric.tools:gradle:1.26.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url 'https://dl.bintray.com/tapsellorg/maven' }
        maven { url 'https://maven.google.com/' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Build.gradle (app) :

dependencies {
    implementation 'com.google.android.gms:play-services-base:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'

but when added this line apply plugin: 'com.google.gms.google-services' , when click on sync show me below error :

The library com.google.android.gms:play-services-base is being requested by various other libraries at [[11.0.2,11.0.2]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

How can I fix it?

like image 899
Dr. Jake Avatar asked Dec 10 '18 11:12

Dr. Jake


People also ask

What is the use of Firebase Crashlytics in Android?

Firebase Crashlytics is a lightweight, realtime crash reporter that helps you track, prioritize, and fix stability issues that erode your app quality. Crashlytics saves you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them.


1 Answers

build.gradle Module

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


// add the Firebase SDK for Google Analytics
// The app need this to init in Firebase console
implementation 'com.google.firebase:firebase-analytics:17.2.1'

 // Add the Firebase SDK for Crashlytics.
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'

build.gradle Project

classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta01'

You do not need fabric.io anymore, it is deprecated and will be available until March 31, 2020. Take a look at this Project and Video

if after all Firebase doesn't recognize the app, record an exception using this recordException

like image 131
AllanRibas Avatar answered Oct 11 '22 22:10

AllanRibas