1

i updated something and suddenly this happened

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

i have looked into the other answers but i could not really figure out what to do or what to change

apply plugin: 'com.android.application'

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

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'
implementation 'com.numetriclabz.numandroidcharts:numandroidcharts:1.0.18'
implementation 'com.xeoh.android:checkboxgroup:1.0.1'
implementation 'com.jjoe64:graphview:4.2.2'
implementation 'androidx.fragment:fragment:1.0.0'
}

what is the proper library to use

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
K.hamdan
  • 103
  • 1
  • 1
  • 9
  • Possible duplicate of [Manifest Merger fails for appComponentFactory](https://stackoverflow.com/questions/52135251/manifest-merger-fails-for-appcomponentfactory) – Anas Mehar Aug 21 '19 at 08:32
  • Migrate to androidX or if you don't want to migrate add "tools:remove="android:appComponentFactory"" in Android Manifest file in tag. – Prayag Gediya Aug 21 '19 at 08:34

2 Answers2

2

You are using both support libraries and androix libraries, and you can't do it.

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.fragment:fragment:1.0.0'

You have to migrate to Androidx:

  • 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
0

As mention here

https://github.com/material-components/material-components-android/issues/193#issuecomment-486932223

Add two lines to gradle.properties file:

android.useAndroidX=true
android.enableJetifier=true
Chanaka Weerasinghe
  • 5,404
  • 2
  • 26
  • 39