【Android開發】&More than one file was found with OS independent path 'META-INF/androidx

今天在拿到工程後,這份源代碼一部分是由另外同事寫的,而在我們的機子上運行卻是出現如圖的錯誤。最後查閱了相關的資料,原本想着在packagingOptions中添加去掉重複編譯。結果添加了,又出現了新的錯誤。

 packagingOptions {
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'
        exclude 'META-INF/androidx.loader_loader.version'
    }

最後查閱了相關資料,是android.support和android不能共存,而我們在dependencies就出現兩個公用的情形,用的recyclerview

,那解決問題的辦法自然就是刪除掉android.support庫即可。

    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章