Rxjava 报的的java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.错误

1、Rxjava 频繁的多次请求同一个借口 报错误Fatal Exception thrown on Scheduler.Worker thread.


如图(1)

这是我封装的Rxjava+Retrofit

public static T getService(Class tClass) {

 Retrofit retrofit =new Retrofit.Builder()

            .baseUrl(NetWork.BaseUrl)

             .addConverterFactory(GsonConverterFactory.create(new GsonBuilder().create()))

            .addCallAdapterFactory(RxJavaCallAdapterFactory.create())

            .build();

return retrofit.create(tClass);

}


这个会报错误

修改之后:

public static T getService(Class tClass) {

        Retrofit retrofit =new Retrofit.Builder()

                            .baseUrl(NetWork.BaseUrl)

                            .addConverterFactory(GsonConverterFactory.create(new Gson()))//2019-4-49 modify

                            .addCallAdapterFactory(RxJavaCallAdapterFactory.create())

                            .build();

return retrofit.create(tClass);

}


你可能感兴趣的:(Rxjava 报的的java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.错误)