Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manifest merger failed: Attribute application@appComponentFactory

So all good but I'm trying to add this library https://github.com/wdullaer/MaterialDateTimePicker with this

implementation 'com.wdullaer:materialdatetimepicker:4.0.1'

And suddenly when I sync my Graddle it give me this 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:10:5-53:19 to override.

And even if I add that suggestion in my Manifest

<?xml version="1.0" encoding="utf-8"?>
   <manifest xmlns:android="http://schemas.android.com/apk/res/android"    
   xmlns:tools="http://schemas.android.com/tools"
   package="com.itt.ceatm">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:appComponentFactory"> // HERE
    <activity...

Im not able to get it done because now I get this error

Manifest merger failed with multiple errors, see logs

Here is my full Manifest

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.itt.ceatm"
    minSdkVersion 19
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    android.defaultConfig.vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
 }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.mikhaellopez:circularimageview:3.2.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.github.ganfra:material-spinner:2.0.0'

implementation 'com.wdullaer:materialdatetimepicker:4.0.1' //NEW LIBRARY

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'}

Any advices? I already do a research, trying to do work arround including the block code of configureall and others but no success. Im stuck

Or even another recomendation of a library for DatePicker with material design would be appreciated

EDIT - SOLUTION: Thanks to all btw So downgrading the library was ok but then it gave me this error

Error about different versions support (I can't put it directly due to my level, sorry)

Then I did a research and added this new 2 implementations

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

implementation 'com.android.support:support-v13:28.0.0' //THIS
implementation 'com.android.support:support-media-compat:28.0.0' //AND THIS

implementation 'com.mikhaellopez:circularimageview:3.2.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.github.ganfra:material-spinner:2.0.0'

implementation "com.wdullaer:materialdatetimepicker:3.6.4"

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'}

And then I was able to use the library without errors

Thanks to all again!

like image 795
Angel R Avatar asked Oct 28 '18 06:10

Angel R


People also ask

How do I fix a failed manifest merger?

Try adding the following labels to resolve the issue: Add the xmlns:tools line in the manifest tag. Add tools:replace= or tools:ignore= in the application tag.

What is App Component Factory?

AppComponentFactory is a factory class that you can extend from and inside, you can return your custom Activity, Application, Service, BroadcastReceiver, and ContentProvider. How does it work? Well, if you ever have tried ViewModelFactory or FragmentFactory , all of them practically works in the same way.


1 Answers

the date-picker has androidx as a dependency. downgrading to version 3.6.4 would make it depend on android.support again - or upgrade your app to use androidx. see issue 543.

// https://mvnrepository.com/artifact/com.wdullaer/materialdatetimepicker
implementation "com.wdullaer:materialdatetimepicker:3.6.4"

^ this would be the most easy way to fix the conflicting dependencies.

like image 96
Martin Zeitler Avatar answered Oct 10 '22 02:10

Martin Zeitler