解決Android Studio 3.0導入module依賴後unable to merge index
阿新 • • 發佈:2018-03-15
無法 文件夾 post -i 估計 檢查 gradle 網上 mar , 我的項目gradle插件版本3.0.1, gradle版本4.1
解決Android Studio 3.0導入module依賴後unable to merge index
項目需要使用im, 在項目裏導入了騰訊im的幾個module依賴, 項目無法編譯, 報錯unable to merge dex
網上搜索一番後發現解決方案大致分以下幾種:
- 先clean再rebuild, 刪除.gradle文件夾 clean rebuild....
- 降低play-service版本, 騰訊IM demo中用的play-serivce是3.0的, 估計已經夠低了 :)
- 依賴沖突導致
試了前兩種方案沒有解決我的問題, 我的項目是近期創建的, 騰訊IM demo的gradle插件版本是2.3.3, gradle版本3.3
使用./gradlew dependencies
, 檢查依賴, 發現多處傳遞依賴, 幾個庫module中compile sdk版本有的是22, 有的是23, 因此使用的support包版本也不相同, 導致依賴版本沖突
使用gradle3新增函數implementation
替換庫module中的compile
函數, implementation
導入的依賴只會在module內部引用而不會傳遞, 問題解決.
解決Android Studio 3.0導入module依賴後unable to merge index