Retrofit官网http://square.github.io/retrofit/
这一周学习了Retrofit的使用,学习资料来自网络。
推荐具备实操性的一篇文章:http://wuxiaolong.me/2016/01/15/retrofit/
我按照这篇文章写了一个小demo,遇到了两点错误,记录以下:
1 AndroidSchedulers.mainThread(),AndroidSchedulers无法导入包
原因:缺少rxandroid库
解决方法:添加compile ‘io.reactivex:rxandroid:1.2.1’
2 RxJavaCallAdapterFactory cannot be converted to CallAdapter.Factory
解决方法:
确保Retrofit依赖,Gson converter依赖和RxJava adapter依赖版本号统一。
应该像下面这样:
compile ‘com.squareup.retrofit2:retrofit:2.0.2’
compile ‘com.squareup.retrofit2:converter-gson:2.0.2’
compile ‘com.squareup.retrofit2:adapter-rxjava:2.0.2’
原文地址:http://stackoverflow.com/questions/37727928/rxjavacalladapterfactory-cannot-be-converted-to-factory
想了解更多相关知识,
http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0915/3460.html
http://gank.io/post/560e15be2dca930e00da1083
https://gank.io/post/56e80c2c677659311bed9841
另外,还学到了Android studio安装GsonFormat可以快速生成Java Bean,非常方便。