解决Manifest merger failed : Attribute application@appComponentFactory

2023-05-16

在将butterknife升级到10.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:11:5-34:19 to override.

经过查阅资料后得知是butterknife在10.0.0的时候引用的AndroidX,而AndroidX无法与support支持包共存导致了该错误。谷歌在api28之后将不在提供support的支持包。以后将使用AndroidX来整合代替。

解决方法1

在gradle.properties中添加如下

suppport_library_version=28.0.0
android.useDeprecatedNdk=true
android.useAndroidX=true
android.enableJetifier=true

解决方法2

  • 需要你的项目build.gradle中的插件版本要在3.2.0以上

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

解决Manifest merger failed : Attribute application@appComponentFactory 的相关文章

随机推荐