-2

Running Java 8, Gradle plugin version 3.1.0

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

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="io.branch.branchster"
    android:versionCode="20"
    android:versionName="1.4.0" >

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:largeHeap="true"
        android:allowBackup="true"
        android:name="io.branch.branchster.ApplicationMainClass"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name">
        <activity
            android:name="io.branch.branchster.SplashActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.Transparent"
            android:launchMode="singleTask" >

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

            <!-- Branch URI scheme -->
            <intent-filter>
                <data android:scheme="branchster" android:host="open" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>

            <!-- Branch App Links -->
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" android:host="pokewalk.app.link" />
            </intent-filter>

        </activity>

        <activity
            android:name="io.branch.branchster.MonsterViewerActivity"
            android:theme="@style/Theme.Default"
            android:launchMode="singleInstance"
            android:screenOrientation="portrait">
        </activity>

        <activity
            android:name="io.branch.branchster.MonsterCreatorActivity"
            android:theme="@style/Theme.Default"
            android:launchMode="singleInstance"
            android:screenOrientation="portrait">
        </activity>
        <!-- Branch init -->
        <meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_kp3tvgY7sTcQFt7qaluaonjmutgWYzkR" />
        <!-- Branch testing (TestMode "true" to simulate fresh installs on dev environment) -->
        <meta-data android:name="io.branch.sdk.TestMode" android:value="false" />
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

    </application>

</manifest>

Build.gradle app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 31
    defaultConfig {
        applicationId "com.eneff.branch.example.android"
        minSdkVersion 16
        targetSdkVersion 31
        versionCode 4
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories{
    flatDir{
        dirs 'libs'
    }
}

dependencies {
    implementation 'io.branch.sdk.android:library:5.+'
    implementation 'com.google.firebase:firebase-appindexing:19.0.0'
    implementation 'com.google.android.gms:play-services-ads-identifier:16+'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.android.gms:play-services:6.5.87'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:25.2.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:design:28.0.0'
    implementation 'androidx.browser:browser:1.0.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'io.branch.sdk.android:library:4.+'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.1.0-alpha04'

}```
Ruli
  • 2,592
  • 12
  • 30
  • 40
Jay S
  • 1
  • 1
  • can you just do a quick google search. There are tons of info related to this error. https://stackoverflow.com/questions/51793345/android-material-and-appcompat-manifest-merger-failed – Imran Ali Aug 31 '21 at 14:29
  • 3
    Does this answer your question? [Android Material and appcompat Manifest merger failed](https://stackoverflow.com/questions/51793345/android-material-and-appcompat-manifest-merger-failed) – Ruli Sep 03 '21 at 20:22

1 Answers1

0

I had similar problem. After migration to AndroidX, problem fixed!

Screenshot

Ruli
  • 2,592
  • 12
  • 30
  • 40