美文网首页
解决Manifest merger failed : Attri

解决Manifest merger failed : Attri

作者: 冬絮 | 来源:发表于2019-06-13 10:08 被阅读0次
    在将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来整合代替。


    butterknife的issue.png

    解决方法1

    在gradle.properties中添加如下

    suppport_library_version=28.0.0
    android.useDeprecatedNdk=true
    android.useAndroidX=true
    android.enableJetifier=true
    
    如图所示.png

    解决方法2

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


      改变所有import:support支持包为androidx.png

    相关文章

      网友评论

          本文标题:解决Manifest merger failed : Attri

          本文链接:https://www.haomeiwen.com/subject/kvhjfctx.html