2014-06-09 11 views
5

Sto utilizzando Retrofit-1.6.0 + okhttp-2.0.0-RC1 nel mio progetto. quando eseguo il progetto ottengo l'errore.L'aggiornamento ha rilevato un OkHttp non supportato sull'errore del percorso di classe in OKHttp 2.0

java.lang.RuntimeException: Retrofit detected an unsupported OkHttp on the classpath. 
To use OkHttp with this version of Retrofit, you'll need: 
1. com.squareup.okhttp:okhttp:1.6.0 (or newer) 
2. com.squareup.okhttp:okhttp-urlconnection:1.6.0 (or newer) 
Note that OkHttp 2.0.0+ is supported! 

Qualcuno sa come risolvere questo problema?

risposta

12

Anche con OkHTTP 2 è necessario importare l'URLConnection più

compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'

2

ho avuto picasso/Retrofit complaning lo stesso modo di fare. Questa configurazione ha funzionato per me:

compile 'com.squareup.retrofit:retrofit:1.9.0' 
compile 'com.squareup.okhttp:okhttp:2.0.0' 
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' 
compile 'com.squareup.picasso:picasso:2.5.2' 
+0

Grazie a @voghDev Ha funzionato per me :) – Mucahit

+0

In realtà se si utilizza il retrofit 1.9.0 si ** non è necessario importare 'okhttp-urlconnection: 2.0.0' **. _Se si utilizza OkHttp è necessario utilizzare la versione 2.0 o successiva e non è più necessario utilizzare lo shim okhttp-urlconnection._ [Retrofit 1.9.0 CHANGELOG] (https://github.com/square/retrofit/blob /parent-1.9.0/CHANGELOG.md). –

+0

@Ryan Posso confermare che sto avendo un errore EOFError usando il retrofit 1.9.0, che non appare più dopo l'importazione del retrofit 1.9.0 + okhttp2.3 + okhttp-urlconnection2.3. Questo errore mi è successo proprio ora, su un Samsung SIII – voghDev

Problemi correlati