0

after I set my target and compile sdk versions to 28, I keep seeing this error:

Manifest merger failed : Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0] 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:8:5-41:19 to override.

Here is the app:gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28

    lintOptions {
        abortOnError false
    }

    defaultConfig {
        applicationId "com.tawkon.data.lib.indooroutdoor"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 3
        versionName "1.6.4"
    }
    buildTypes {
        release {
            debuggable false
        }
        debug {
            debuggable true
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0-rc01'
    implementation 'de.greenrobot:eventbus:2.4.1'
    implementation 'com.splunk.mint:mint:4.2.1'
    implementation 'joda-time:joda-time:2.3'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation project(':library')
}

I tried adding tools:replace="android:appComponentFactory" to application tag in the manifest, but it keep showing the error:

 Manifest merger failed with multiple errors, see logs

What can be done to fix this?

Sayan Mukherjee
  • 352
  • 2
  • 21
Keselme
  • 3,779
  • 7
  • 36
  • 68
  • 1
    Did you try adding android.useAndroidX=true android.enableJetifier=true in your gradle.properties file – p.mathew13 Mar 26 '19 at 10:04
  • Check your layouts thoroughly ..whether some where you are using the old appcompat library widgets instead of android x.. – Santanu Sur Mar 26 '19 at 10:05
  • Try replacing implementation 'com.google.android.material:material:1.0.0-rc01' with implementation 'com.google.android.material:material:1.0.0' – p.mathew13 Mar 26 '19 at 10:10

4 Answers4

0

Hi if you used androidx then please check your library project all dependency is androidx or not.. and change this dependency

    implementation 'com.google.android.material:material:1.0.0'
0

Go to manifest file. And click on Merged Manifest. There you can find the suggestions just click on replace the error will be solved.

enter image description here

0

Please change this dependency implementation 'androidx.appcompat:appcompat:1.0.0' to implementation 'com.android.support:appcompat-v7:28.0.0' hopefully it will be of help to you.

Kaushal Panchal
  • 1,785
  • 1
  • 11
  • 27
  • It was originally com.android.support:appcompat-v7:28.0.0 I got the same error, this is why I changed it to implementation 'androidx.appcompat:appcompat:1.0.0' – Keselme Mar 26 '19 at 11:43
  • i have already face this issue after that research on that and got some result. Some dependency not migrate in androidx. so simply for now you use only android support dependency. try to downgrade dependency. Hope this work for you. – Kaushal Panchal Mar 26 '19 at 12:29
0

follow these steps :-

  1. add these two lines in grade.properties

android.useAndroidX=true

android.enableJetifier=true

  1. Replace implementation 'com.android.support:appcompat-v7:28.0.0' with implementation 'androidx.appcompat:appcompat:1.1.0'
  2. sync your projects.
  3. After sync project u need to change package name from import android.support.v7.app.AppCompatActivity to import androidx.appcompat.app.AppCompatActivity in Each activity
Shubham
  • 91
  • 1
  • 4