Retrofit学习笔记(一)

github上的介绍,简单明了

Type-safe HTTP client for Android and Java by Square, Inc. http://square.github.io/retrofit/

项目地址:https://github.com/square/retrofit

目前Retrofit 已经更新到2.0.0-beta1版本,api进行了大量的更新

请看这篇文章的介绍

http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0915/3460.html

但是Retrofit自动依赖最新版本的okhttp

okhttp也是retrofit公司开源的项目
项目地址:https://github.com/square/okhttp

截止目前,jcenter最新版本的okhttp为2.5.0版本(可在这里查看jcenter中的okhttp)

但是该版本的okhttp中有如下一个bug:

https://github.com/square/retrofit/issues/1058

大概的情况是:当请求的url中含有需要转义的字符后,经过okhttp转义之后,在构建URI的时候会报如下错误:

java.lang.IllegalStateException: not valid as a java.net.URI:

但是okhttp 已经修改了这个 bug ,详情如下:

https://github.com/iagreen/okhttp/commit/597c279dfe51daf30457da85cc033feb34325286

image

原来报错即是图中的334行,现在进行了修改。

但是目前还没有把最新的okhttp发布到jcenter,so目前还是有问题。

期待最新的okhttp发布…

原文地址:https://www.cnblogs.com/hsx514/p/4832620.html