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!
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.
You are getting this error because the library you are importing is based on androidx which is a major improvement on the support libraries you are using.
Now you three solutions:
Use another Date picker library which is based on the previous support versions (Recommended and best way).
Change your support libraries to androix. (Recommended but difficult)
Add ignore tools (Easy way out)
Here is a link I found: Date Picker
implementation 'com.github.Kunzisoft:Android-SwitchDateTimePicker:2.0'
来源:https://stackoverflow.com/questions/53029017/manifest-merger-failed-attribute-applicationappcomponentfactory