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 ...
随机推荐
- QQ登录网站接入
QQ网站登录是一个非常常用的功能,网上有很多的资料,在此只做一个整理: QQ登录接入也在不断的升级,目前我发布的是2.1,很多资料里显示的那些繁杂的步骤已经不需要了: 第一步需要先申请,申请地址如下: ...
- socket通信_笔记
(socket通信) 客户端与服务器端通信问题: 我们首先要了解一个概念性的词汇:Socket socket的英文原义是“孔”或“插座”.作为进程通信机制,取后一种意思.通常也称作“套接字”,用于描述 ...
- Python3 内建模块 hashlib、itertools、HTMLParser、urllib
Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度固定的数据串(通常用16进制 ...
- centos 安装php ide (eclipse + php 插件)
1.检查更新并安装eclipse yum check-update yum install eclipse*此时的 eclipse 已经安装好了,默认是在/usr/lib/下的,可以通过cd /u ...
- Magento Api 记录
magento api 首次接触 (-) /** * magento Api 身份验证 调用示例 * Example of simple product POST using Admin accoun ...
- ZeroMQ/jzmq安装使用
环境: No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.2 LTS Release: 12 ...
- jenkins 重新设置 管理员密码
由于服务器瘫痪,修好之后经常不上,就把jenkins的管理密码忘掉了. 查阅了网上所有方案之后发现没有一个 能正确修改密码的,特此列出下列网上的方法 第一.设成无需密码验证的(网上有教程,不过并不能修 ...
- 一个基于集成jenkins的测试平台
(一)先看测试业务的情况: 有各种各样的任务包括代码构建.部署搭建.单元测试.功能自动化测试(包括许多模块的功能自动化测试,有十几个居多),性能测试.正确性验证:复杂一点的是这些任务在不同的测试阶段中 ...
- MSSql ID自动增长删除数据重1开始
dbcc checkident('db_Tome1.dbo.员工信息表',reseed,0) 注:dbcc checkident('表名',reseed,0)
- 我的第一个python代码实践:Trie树
Trie树 不解析, 本园很多博文有提到. 直接上代码: #coding:utf-8 ''' create on 2013-07-30 @author :HuangYanQiang ''' LETT ...