Ahmed ibrahim
Ahmed ibrahim

Reputation: 1175

why am i getting Manifest merge error when apply firebase and google authentication libraries

i am trying to connect my app to firebase and use the google authentication system inside it

when applying the libraries i get a manifest merge error the error is in this line

implementation 'com.google.firebase:firebase-core:17.0.0'

this is the error i get

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:5:5-23:19 to override.

when downgrading the version to 16.0.0 the error is gone however I can't add any other libraries for example if I want to add

implementation 'com.google.firebase:firebase-auth:18.0.0'

I get this error

ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.
1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-stats:15.0.1 -> com.google.android.gms:play-services-basement@[
15.0.1], but play-services-basement version was 17.0.0.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-core@{strictly 16.0.0}
-- Project 'app' depends onto com.google.android.gms:play-services-flags@{strictly 17.0.0}
-- Project 'app' depends onto com.google.firebase:[email protected]
-- Project 'app' depends onto com.google.firebase:[email protected]
-- Project 'app' depends onto com.google.firebase:firebase-analytics-impl@{strictly 16.0.0}

I am new to android and any advice would be great

this is my app build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.firebasetestingprojecttwo"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:gridlayout-v7:28.0.0'


    implementation 'com.google.firebase:firebase-core:17.0.0'

}

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

Upvotes: 2

Views: 332

Answers (2)

Jordan Kotiadis
Jordan Kotiadis

Reputation: 566

Either you imigrate to androidX or you downgrade your firebase for example I use

implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.6'`

Upvotes: 0

Prashanthv
Prashanthv

Reputation: 109

I'm currently on the following versions. Try this, this might work. downgrade the firebase-core version to 16.0.0

implementation 'com.google.firebase:firebase-core:16.0.0'

and make firebase-auth version to 11.6.0

implementation 'com.google.firebase:firebase-auth:11.6.0'

Upvotes: 2

Related Questions