错误报告:
03-08 21:02:12.163 17324-17613/com.xiaoyan.sharesystem E/AndroidRuntime: FATAL EXCEPTION: RxIoScheduler-2
Process: com.xiaoyan.sharesystem, PID: 17324
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:62)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NoSuchMethodError: No interface method rangeEquals(JLokio/ByteString;)Z in class Lokio/BufferedSource; or its super classes (declaration of 'okio.BufferedSource' appears in /data/data/com.xiaoyan.sharesystem/files/instant-run/dex/slice-okio-1.7.0_88bbf161613767cc63a49f9e8b34c36f9a000a7f-classes.dex)
at okhttp3.internal.Util.bomAwareCharset(Util.java:412)
at okhttp3.ResponseBody.string(ResponseBody.java:173)
at cn.bmob.v3.http.This$5.call(BmobClient.java:1274)
at rx.Observable.unsafeSubscribe(Observable.java:8666)
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
at rx.Observable.unsafeSubscribe(Observable.java:8666)
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
at rx.Observable.unsafeSubscribe(Observable.java:8666)
at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:220)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:833)
出现这个问题的原因是retrofit依赖的okhttp和Bmob提供的sdk的远程aar包中的okhttp重复导致的,只要将
compile 'com.squareup.retrofit2:retrofit:2.2.0'
改为
compile ('com.squareup.retrofit2:retrofit:2.1.0'){
exclude group : 'com.squareup.okhttp3'
}
当然,记得改后Rebuild Project即可