Retrofit 相关
更上一层楼-Android研发工程师高级进阶
Retrofit 解析 JSON 数据
Retrofit 2.0: The biggest update yet on the best HTTP Client Library for Android
Retrofit 2 — Upgrade Guide from 1.9
Retrofit 开发示例
使用 Retrofit Post发送一个对象
Retrofit — Send Objects in Request Body
method POST must have a request body
Retrofit: API Integration Made Easy
问题分析总结
出现错误
java.lang.IllegalArgumentException: Unable to create call adapter for rx.Observable<java.util.List<com.coam.model.test.GithubUser>>
需要将rxjava结合到retrofit,在构建请求客户端的地方加上 .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) 如下:
Retrofit retrofit = new Retrofit.Builder().baseUrl(ENDPOINT)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
//mService = retrofit.create(GithubAPIInterface.class);
return new GithubService(retrofit.create(GithubAPIInterface.class));
并在dependencies中引入
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'