Rxjava遇到的问题----RxIoScheduler-2

public class ApiService {
    private static OkHttpClient okHttpClient = new OkHttpClient.Builder().
            addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
            .build();
    private static Retrofit retrofit  = new Retrofit.Builder()
            .baseUrl("http://japi.juhe.cn/")
            .client(okHttpClient)
            .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
            .addConverterFactory(GsonConverterFactory.create())
            .build();
    private ApiService(){

    }
    public static <T> T createApi(Class<T> clazz) {

        return retrofit.create(clazz);
    }
}
public interface Api {
    @GET("joke/content/text.from")
    Observable<JokeBean> getJokeBean(@Query("page") int page, @Query("pagesize") int pagesize, @Query("key") String key);
}

出现了上述问题,RxloScheduler-2这个问题,也就是NetWorkerOnMain,检查

 compile 'com.squareup.retrofit2:retrofit:2.0.1'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.1'
    compile 'com.squareup.retrofit2:converter-gson:2.0.1'
    compile 'com.google.code.gson:gson:2.6.2'
    //rxjava
    compile 'io.reactivex:rxjava:1.1.2'
    compile 'io.reactivex:rxandroid:1.1.0'
    //okhttp
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'

最后改成这样就可以了,必须是rxjava跟retrofit的版本能兼容还是怎么回事,反正改完就可以了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值