build.gradle dependancies for retrofit and latest version of okhttp

Viewed 4891

In our application we use retrofit for networking with the following dependancies:

 compile 'com.squareup.retrofit2:retrofit:2.3.0'
 compile 'com.squareup.retrofit2:converter-gson:2.3.0'

Of late we started getting this crash which has been resolved. How then do i fix this within our app? My understanding is that retrofit is built on top of the okHttp library. So does this mean we would have to wait for a new version of retrofit that includes the new okHttp version OR I can manually include the new version of okHttp as a seperate dependancy and end up with:

 compile 'com.squareup.retrofit2:retrofit:2.3.0'
 compile 'com.squareup.retrofit2:converter-gson:2.3.0'
 compile 'com.squareup.okhttp3:okhttp:3.8.1'

Proguard config is (only the retrofit part though)

-dontnote retrofit2.Platform
-dontwarn retrofit2.Platform$Java8
-dontwarn okhttp3.**
-dontwarn retrofit2.**
-dontwarn com.squareup.picasso.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * { @retrofit2.http.* <methods>; }
-keepclasseswithmembers interface * { @retrofit2.* <methods>; }
-dontwarn okio.**
3 Answers
compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup:otto:1.3.8'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
Related