close

今天在試著引入 Butterknife 10.1.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-23:19 to override.

 

此錯誤訊息告訴我們 Manifest 合併時失敗

其實是 support v28 和 androidx 無法同時存在的關係

Butterknife 用到了 androidx 但我們專案用的是 support v28

因此合併失敗

 

想要解決此問題,有兩個方法

1、降低 Butterknife 的版本至 8.8.1

2、自己的專案改為使用 androidx ( 官方表明,不強制更新,但之後的新功能都只會加在 androidx 中 )

 

 

 

資料來源:https://links.jianshu.com/go?to=https%3A%2F%2Fblog.csdn.net%2Fqq_38350635%2Farticle%2Fdetails%2F87785551

 

 


arrow
arrow
    創作者介紹
    創作者 顏澤偉 的頭像
    顏澤偉

    Willy's Fish教學筆記』

    顏澤偉 發表在 痞客邦 留言(0) 人氣()