1. 程式人生 > >Dependency Error.See console for detail 解決

Dependency Error.See console for detail 解決

當執行專案出現> Dependency Error.See console for detail


先不要忙著查百度(雖然這時候已經查了),因為可能性很多,我們可以先開啟as右下角的Gradle Console,選擇下圖框好的--debug option,會編譯gradle


然後左邊Messages裡面會出現錯誤原因,例如我專案中出現的是. Resolved versions for app (3.0.1) and test app (2.0.1) differ.出現這個錯的原因是由於新增的依賴版本是最新的,而程式碼倉庫裡邊並沒有最新的依賴導致報錯


解決方法:在gradle中新增如下程式碼,其中3.0.1是看錯誤裡面的版本而定

 configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
    }

同步一下,再次Run專案即可成功執行。