9

I'm trying to update my google and firebase SDK libraries in my project to solve the problem of install_referrer deprecation but I got errors after sync

ERROR: Failed to resolve: com.google.firebase:firebase-crash:17.2.2

and this error on the merged manifest

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:28:5-422:19 to override.

here is my firebase and google dependency

    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-crash:17.2.2'
    implementation 'com.google.firebase:firebase-config:19.1.1'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'

    implementation 'com.google.android.gms:play-services-base:17.1.0'
    implementation 'com.google.android.gms:play-services-analytics:16.0.8'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'

    implementation 'com.google.firebase:firebase-core:17.2.2'
    implementation 'com.google.firebase:firebase-ads:18.3.0'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
  • Check here: https://firebase.google.com/support/release-notes/android, this one doesn't exists (com.google.firebase:firebase-crash:17.2.2) try com.google.firebase:firebase-crashlytics:17.0.0-beta01 – Azhagthott Feb 12 '20 at 09:19

5 Answers5

19

Use the following dependency:

implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'

And Update your application to use AndroidX:

Upgrade com.android.tools.build:gradle to v3.2.1 or later.

Upgrade compileSdkVersion to 28 or later.

Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.

https://developer.android.com/jetpack/androidx/migrate


Update:

You can now use the following dependency version:

dependencies {
    // Recommended: Add the Firebase SDK for Google Analytics.
    implementation 'com.google.firebase:firebase-analytics:17.5.0'

    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
}

If you are having trouble adding firebase-crashlytics, then check the following documentation:

https://firebase.google.com/docs/crashlytics/get-started?platform=android

https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • 1
    I don't want to migrate to android x this will effect some other dependencies in my project I already compile my code with SDK version 28 and gradle version :3.3.2 also classpath 'com.google.gms:google-services:4.3.2' –  Feb 12 '20 at 09:51
  • this dependency does exist `com.google.firebase:firebase-crash:17.2.2`, you need to use the dependency i wrote in the answer but use an older version – Peter Haddad Feb 12 '20 at 09:52
8

Try to change com.crashlytics.sdk.android:crashlytics:17.2.2 to com.google.firebase:firebase-crashlytics:17.2.1.

This worked for me.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Denis
  • 81
  • 1
  • 3
4

Steps to add the new Firebase Crashlytics before november deprecation

from your build.gradle project module

    // Remove Fabric's Maven repository from allProjects.
    maven { url 'https://maven.fabric.io/public' }

    // Remove the Fabric Gradle plugin.
    classpath 'io.fabric.tools:gradle:1.31.2'

    // Add the Firebase Crashlytics Gradle plugin.
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'

From your build.gradle app module

// Remove the Fabric plugin.
apply plugin: 'io.fabric'

// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'


dependencies {
  // Remove the Fabric Crashlytics SDK.
  implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

  // Add the Firebase Crashlytics SDK.
  implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
}

The links commented with // Remove should not be in your gradle configuration, instead add the suggested dependencies and plugins

Source: https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android

As a quote from Peters answer, you should also have

Upgrade com.android.tools.build:gradle to v3.2.1 or later.

Upgrade compileSdkVersion to 28 or later.

Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.

Gastón Saillén
  • 12,319
  • 5
  • 67
  • 77
  • Thanks. Your answer is the most relevant to this question. A bit outdated though. I followed the link you mentioned. And followed instructions from there. It solved my problem. – Imtiaz Dec 18 '20 at 15:09
1

Follow below document to intergrade crashlytics into your project

https://firebase.google.com/docs/crashlytics/get-started?platform=android&authuser=0#add-sdk

Project requirements

  • compileSdkVersion 29 or later
  • Gradle version com.android.tools.build:gradle:4.0.1
  • if your project not contains androidX then Migrate your project into AndroidX

https://developer.android.com/jetpack/androidx/migrate

SAVALIYA REENA
  • 218
  • 2
  • 15
0
    // Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:29.0.0')

    // Declare the dependencies for the Crashlytics and Analytics libraries
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.firebase:firebase-analytics'

Refrence

Sharhabeel Hamdan
  • 1,273
  • 13
  • 15