2016-08-23 59 views
0

我最近開始使用Android Studio解決此問題,並且它一直在推動我走上正軌。我不斷收到錯誤「無法解析:com.squareup.okio:okio:1.8.0」。這些都是依賴我:Android Studio無法讀取圖書館

dependencies { 

    compile 'com.google.code.gson:gson:2.6.2' 
    compile 'com.squareup.retrofit2:retrofit:2.1.0' 
    compile 'com.squareup.retrofit2:converter-gson:2.1.0' 

    compile files('libs/okio-1.8.0.jar') 

    compile files('libs/retrofit-2.1.0 (1).jar') 
    } 

正如你所看到的,我有改造和GSON庫簡單地編譯(我假定這將下載它們從互聯網上),我想這樣做與奧基奧但它同樣沒有解決,所以我特意下載了1.8.0 Okio JAR,但仍然無法解決。爲什麼會這樣呢?任何答案將不勝感激。謝謝

+0

你嘗試編譯 'com.squareup.okio:奧基奧:1.9.0'? –

+0

嘗試清理並重建項目 –

+0

嘗試http://stackoverflow.com/a/16628496/1157879 – Nikhil

回答

0

不要把依賴作爲一個Gradle依賴性:

compile 'com.squareup.retrofit2:retrofit:2.1.0' 

而且隨着src/libs .jar文件:在同一時間

compile files('libs/retrofit-2.1.0 (1).jar') 

。只選擇一種方法。我建議你選擇Gradle依賴關係,因爲它們是自動獲取的。

在你的情況下,dependencies部分應該是這樣的:

dependencies { 
    compile `com.google.code.gson:gson:2.7` 
    compile 'com.squareup.retrofit2:retrofit:2.1.0' 
    compile 'com.squareup.retrofit2:converter-gson:2.1.0' 

}