新版ButterKnifeの坑

平常習慣用ButterKnife進行控件綁定android

GIitHubgit

心血來潮...github

升級使用最新版本 10.1.0編譯不能經過api

dependencies {
  implementation 'com.jakewharton:butterknife:10.1.0'
  annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}

編譯報錯app

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

日誌分析:ide

關鍵字 Manifest merger failed 、androidx 大概得出是重複引用了.net

給出的修改意見 Suggestion: add 'tools:replace="android:appComponentFactory"' 修改後引入新的問題日誌

調查結果code

ButterKnife最新版本已經對應AndroidX升級xml

若是當前你項目沒有支持AndroidX將致使依賴衝突

至於詳細緣由見:AndroidX兼容

無論你喜不喜歡 androidX 它都來了

androidx 出現規範代碼,可是產生一個過渡期,什麼過渡期? support到androidx過渡,對於咱們來講又是一頓查找替換。爲何查找替換,由於原來api類名不變的狀況下,androidx報名所有發生變化。這致使同一個項目中androidx 和 support會產生衝突

AndroidX瞭解一下

 

解決方案

降級:8.8.10

相關文章
相關標籤/搜索