android - list 合并失败 : Attribute application@appComponentFactory

标签 android android-gradle-plugin build.gradle android-manifest

一切都很好,但我正在尝试添加这个库 https://github.com/wdullaer/MaterialDateTimePicker有了这个

implementation 'com.wdullaer:materialdatetimepicker:4.0.1'

当我同步我的 Graddle 时突然出现这个错误

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.

即使我在 list 中添加了该建议

<?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...

我无法完成它,因为现在我得到了这个错误

Manifest merger failed with multiple errors, see logs

这是我的完整 list

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

有什么建议吗?我已经做了一项研究,试图围绕包括 configureall 和其他 block 代码在内的工作进行工作,但没有成功。我卡住了

或者即使是另一个具有 Material 设计的 DatePicker 库的推荐也将不胜感激

编辑 - 解决方案: 感谢所有顺便说一句 所以降级库是可以的,但它给了我这个错误

Error about different versions support (本人水平不能直接放,sorry)

然后我做了一个研究并添加了这两个新的实现

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

然后我就可以毫无错误地使用这个库了

再次感谢大家!

最佳答案

日期选择器有 androidx 作为依赖项。降级到版本 3.6.4 将使其再次依赖于 android.support - 或者升级您的应用以使用 androidx。见issue 543 .

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

^ 这将是解决冲突依赖项的最简单方法。

关于android - list 合并失败 : Attribute application@appComponentFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53029017/

相关文章:

android - "Unsupported type ' PreferenceActivity ' in file"Android

android - 在 Google Play 之外更新 Android 应用程序

android - 无法将项目导入android studio

android - 如何不对项目设置进行硬编码

gradle - 如果文件被Gradle守护程序锁定,如何处理情况

android-studio - 错误 : more than one library with package name 'android.support.graphics.drawable'

android如何调用其他类的重写方法

java - Eclipse 中的 Android 'create table if not exist' 错误

android - 从服务器 : Proxy Authentication Required 收到状态代码 407

android - 更新 Android Studio 后 Gradle 构建错误