#錯誤提示
提示Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidM
#解決辦法
##使用Androidx
其實時沒有添加Androidx支持,同時有引入了其他版本的support包導致,如果要使用androidx(推薦)則需要在gradle.properties 文件裏面添加如下配置(沒有的話可以新建,位於項目根目錄下):
android.useAndroidX=true //表示啓用 androidx
android.enableJetifier=true //表示將依賴包也遷移到androidx
其中 android.enableJetifier=true 表示將依賴包也遷移到androidx 。如果取值爲false,表示不遷移依賴包到androidx,但在使用依賴包中的內容時可能會出現問題
##使用Android support
需要刪除Androidx相關的引用,然後配置support一致即可,如果有衝突可參考網上的配置。
implementation ("com.github.bumptech.glide:glide:4.7.1") {
exclude group: 'com.android.support'
}
group:表示只要包含com.android.support的都排除
如 com.github.bumptech.glide:glide:4.7.1 包含 com.android.support,當要使用 com.github.bumptech.glide:glide:4.7.1 庫時,要排除其包含的 com.android.support(特定版本),防止與自己版本的 com.android.support 發生衝突。
參考鏈接:https://blog.csdn.net/kang123shi/article/details/86649921
參考鏈接:https://blog.csdn.net/sinat_34933191/article/details/80388856