天天看點

androidx包和android.support庫沖突問題

Manifest merger failed : Attribute [email protected] 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:6:5-23:19 to override.
           

導入别人的工程 gradle打包報錯,提示appCompoentFactory依賴沖突了,

按照建議提示資訊在manifest中添加 tools:replace="android:appComponentFactory"

android:appComponentFactory="android.support.v4.app.CoreComponentFactory

結果一個module下面的class報找不到android.support.v4.app類檔案。。

最後找到一種可行的方案 添加 gradle.properties

添加

android.useAndroidX=true
android.enableJetifier=true
           

全部使用androidx的庫 最後打包成功了,但不确定有沒有問題。。