繁体   English   中英

错误崩溃实现'com.android.support:appcompat-v7:28.0.0'

[英]error crash implementation 'com.android.support:appcompat-v7:28.0.0'

这是我的依赖项(模块:应用程序)

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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'

    implementation 'com.google.android.gms:play-services:12.0.1'
}

添加实现 'com.google.android.gms:play-services:12.0.1' 后,同步模块:app 在实现 'com.android.support:appcompat-v7:28.0.0' 上总是出错

错误 :

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:5:5-19:19 to override.

如何通过选择Refactor > Migrate to AndroidX并让重构完成工作

看来您不想迁移到 AndroidX,但您应该尝试一下,因为 android 支持 28.0.0 是最后一个版本,而 android 从现在起只会更新 androidx。

https://developer.android.com/topic/libraries/support-library/revisions#28-0-0

这是支持库 28.0.0 的稳定版本,适用于生产。 这将是 android.support 包下的最后一个功能版本,鼓励开发者迁移到 AndroidX。

您在一个项目中同时使用support libraryandroidx library ,这就是问题所在。

将支持库更改为首选的AndroidX库。

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
testİmplementation 'junit:junit:4.13-beta-3'
androidTestİmplementation 'androidx.test:runner:1.3.0-alpha01'
androidTestİmplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'

等等.......

你也可以从 Android Studio 本身迁移到 AndroidX

只需转到重构 > 迁移到 AndroidX > 迁移

有关迁移的更多信息,请检查

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM