1

i have android studio project, when i insert AdMob or Firebase Codes in gradle, see this 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:8:1-25:15 to override.

This is my manifest manifest

This is the gradle

    dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    classpath 'com.google.gms:google-services:4.2.0'
}
user311086
  • 920
  • 2
  • 16
  • 29
Mohamed Slimane
  • 311
  • 3
  • 14

2 Answers2

0

its working after add this code to <application>

    tools:replace="android:appComponentFactory"
    android:appComponentFactory="androidx"
Mohamed Slimane
  • 311
  • 3
  • 14
0

The new Firebase libraries and the new Google Play Libraries require androidx. Since you are using these libraries, you are using both support libraries and androidx libraries.

Check the note:

This release is a MAJOR version update and includes breaking changes. With this release, libraries are migrated from the Android Support Libraries to the Jetpack (AndroidX) Libraries. The updated libraries will not work unless you make the following changes in your app:

  • 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.
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841