基于Restful架构规范的Android的网络请求框架Retrofit

基于Restful架构规范的Android的网络请求框架Retrofit .

首先 它有好多的坑 ,安装官网的有时候是搞不出来的。可以大体安照官网进行测试。首先 先说利用android studio 需要编译 两个库。
compile ‘com.squareup.retrofit:retrofit:2.0.0-beta2’(这个是retrofit的类库,这里要完整的路径,有的github上的路径没有后面的版本号。例如 :compile ‘com.squareup.retrofit:retrofit’ 我最开始就是这样的,结果搞了好几天,没有发现问题,后来查了各种博客发现,地址不对。)
compile ‘com.squareup.retrofit:converter-gson:2.0.0-beta2’ (当需要将返回的数据json 格式的数据,自动利用gson类库转换为model对象。现在不需要单独的引入gson这个类库因为 retrofit 里面自己带了,引入compile ‘com.squareup.retrofit:converter-gson:2.0.0-beta2’ 只是告诉 retrofit 让它使用gson 进行解析。

你可能感兴趣的:(Android,网络请求框架)