java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
最近在学习RxJava 感觉很happy ,happy的同时遇到不少问题 没办法一点一点来 上张帅图先

在使用RxJava + Retrofit 的时候 有时候接口请求参数不规范
比如 {}
@FormUrlEncoded
@POST("get_info")
Observable<String> getInfo(@Field("{}") String json); 但是怎么既能够返回
new BaseSubscribe<String>()
有能够返回
new BaseSubscribe<实体类呢?>() 查到
ScalarsConverterFactory scalarsConverterFactory = ScalarsConverterFactory.create();
.addConverterFactory(scalarsConverterFactory)来增加字符串请求 使用
GsonConverterFactory gsonConverterFactory = GsonConverterFactory.create();
.addConverterFactory(gsonConverterFactory)增加实体类请求 但是 我这样做了却不行
后来查到 要这样才行==
可能是版本问题吧。。
GsonConverterFactory gsonConverterFactory = GsonConverterFactory.create(new Gson()); ScalarsConverterFactory scalarsConverterFactory = ScalarsConverterFactory.create();
.baseUrl(ConstantApi.baseUrl)
.addConverterFactory(scalarsConverterFactory)
.addConverterFactory(gsonConverterFactory)
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build(); 别忘了:
//RxJava与Retrofit的适配器
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0' 参考 :http://www.th7.cn/Program/Android/201605/851109.shtml
http://www.jianshu.com/p/dbc46cc033fb
感谢作者 最后截个图看一下目前的代码结构 很酸爽有木有。。。

另外关于新手使用RxJava需要注意的:
subscriptions = new CompositeSubscription();
new CompositeSubscription();来添加 每次请求返回的Subscription对象 记得在BaseActivity中subscription.unsubscribe();
参考:http://blog.chengyunfeng.com/?p=1010感谢 原作者原文中还有很多值得研究学习的东西
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.的更多相关文章
- Exception thrown on Scheduler.Worker thread. Add `onError` handling
<html> <head></head> <body> java.lang.IllegalStateException: Exception throw ...
- 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutputStream() has already been called
错误: 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutput ...
- 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutputStream() has already been called for this response
严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutputS ...
- nested exception is java.lang.IllegalStateException: Cannot forward after response has been committed
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is ...
- nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' a
公司还用的是spring低版本,今天用jre 8测试了一下,发现错误: Unexpected exception parsing XML document from class path resour ...
- Exception in thread "main" java.lang.IllegalStateException: Failed to read 问题解决
开发中偶尔遇到这样的问题:Exception in thread "main" java.lang.IllegalStateException: Failed to read .. ...
- Springboot 上传报错: Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: The multi-part request contained parameter data (excluding uploaded files) that exceede
Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: The ...
- 异常-User class threw exception: java.lang.IllegalStateException: Cannot call methods on a stopped SparkContext.
1 详细信息 User class threw exception: java.lang.IllegalStateException: Cannot call methods on a stopped ...
- SpringBoot整合Elasticsearch启动报错处理 nested exception is java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean wit ...
随机推荐
- 浅谈mysql中不同事务隔离级别下数据的显示效果
事务的概念 事 务是一组原子性的SQL查询语句,也可以被看做一个工作单元.如果数据库引擎能够成功地对数据库应用所有的查询语句,它就会执行所有查询,如果任何一条查 询语句因为崩溃或其他原因而无法执行,那 ...
- 点击按钮文字变成input框,点击保存变成文字
<!DOCTYPE html><html lang="en"> <head> <meta http-equiv="Content ...
- 组织http请求
post方式 string stratTime=""; string end=""://要拼接的参数 string postURL = "http:/ ...
- leetcode 解题 String to Integer (atoi)(C&python)
//此题是easy题,比较简单,主要困难在考虑全输入的各种情况://1.开始的时候有空格等空白字符//2.开头有加减号//3.溢出(第一次写就是没有考虑到这个情况) //C代码int myAtoi(c ...
- 一名IT从业者的英语口语能力成长路径
一名IT从业者的英语口语能力成长路径 来源: 微信公众号 发布时间: 2014-03-12 22:53 阅读: 6134 次 推荐: 24 原文链接 [收藏] 这篇文章是我最近十天口 ...
- Boost IPC Persistence Of Interprocess Mechanisms 例子
下面这一段摘抄自 Boost 1_55_0 的文档,显然标注了 每一个的生命期. One of the biggest issues with interprocess communication m ...
- 聊聊iOS开发中耳机的那点事(监听耳机拔插、耳机线控)-b
如果说一个项目出现的最重大的事故,那无疑就是开发人员使用了不可控的元素. 前言 iOS开发当中有关于视音频播放的开发不在少数,用户时常会使用到一种输出设备,那就是"耳机",这一篇博 ...
- Shell编程练习
1.使用case语句 2.使用while....do....done语句 3.使用
- Codeforces Round #211 (Div. 2)
难得一次比赛能够自己成功A掉四个题: A题:水题,模拟一下就行: #include <iostream> #include <cstdio> using namespace s ...
- tortoisesvn的安装与使用
1.下载安装文件,我用的是1.6.同时可以下载一个中文的安装包. 2.我在F盘建立了一个文件夹tortoisesvn,专门用来放置版本目录文件.然后右键这个文件夹,选择tortoisesvn-> ...