0

Got all these errors in a sudden all build errors "Manifest Merger failed with multiple errors in Android Studio"

that's when i do the replace suggestion by android studio when i don't i get this one

"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 element at AndroidManifest.xml:9:5-43:19 to override."

that's the Manifest

 <application

            android:allowBackup="true"
            android:icon="@drawable/messengered"
            android:label="@string/app_name"
            android:roundIcon="@drawable/messengered"
            android:supportsRtl="true"
            android:theme="@style/AppTheme"
            tools:ignore="GoogleAppIndexingWarning"
            >

        <activity android:name=".NewMessegesActivity">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                       android:value=".LatestMessagesActivity"/>
        </activity>

        <activity android:name=".LatestMessagesActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <activity android:name=".LoginActivity">
        </activity>

        <activity android:name=".RegisterActivity">
        </activity>

    </application>

this is the app gradle

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.xwray:groupie:2.3.0'

    implementation 'com.android.support:recyclerview-v7:28.+'
    implementation 'com.squareup.picasso:picasso:2.71828'
    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'

}

after i tried the marked solution i got a compilation error and fixed it with changing the dependencies from 'android.support' to 'androidx.support' like this

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.firebase:firebase-storage:18.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.xwray:groupie:2.3.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    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'
} 

then reassigned the layouts to 'AppCompatActivity()' cuz it went in errors that will fix it in the Manifest

  • Try this : https://stackoverflow.com/a/28106780/2607144 – Azhar92 Jun 30 '19 at 15:03
  • Try this to troubleshoot your problem:- https://stackoverflow.com/a/56784046/4377954 – Deˣ Jun 30 '19 at 16:05
  • 1
    Possible duplicate of [Android: Adding Firebase Messaging - Menifest merger failed](https://stackoverflow.com/questions/56783967/android-adding-firebase-messaging-menifest-merger-failed) – Deˣ Jun 30 '19 at 16:06

1 Answers1

0

The problem is that your build uses both the old com.android.support namespace as well as the new androidx namespace.

To solve exactly this problem google created their "jetifier" tool, see StackOverflow/What is Jetifier for more information and how to use it.

Kiskae
  • 24,655
  • 2
  • 77
  • 74