ssseasonnn / RxDownload

A multi-threaded download tool written with RxJava and Kotlin
Apache License 2.0
4.14k stars 612 forks source link

为了断网后重新联网可以再次下载,断网,会崩溃 #311

Open iqiqx opened 4 years ago

iqiqx commented 4 years ago

Process: com.example.downloaddemo, PID: 15185 io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | java.net.ConnectException: Failed to connect to /192.168.188.104:8080 at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704) at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701) at io.reactivex.internal.subscribers.LambdaSubscriber.onError(LambdaSubscriber.java:79) at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle$SubscriptionLambdaSubscriber.onError(FlowableDoOnLifecycle.java:85) at io.reactivex.internal.operators.flowable.FlowableDoOnEach$DoOnEachSubscriber.onError(FlowableDoOnEach.java:111) at io.reactivex.internal.operators.flowable.FlowableDoOnEach$DoOnEachSubscriber.onError(FlowableDoOnEach.java:111) at io.reactivex.internal.operators.flowable.FlowableDoOnEach$DoOnEachSubscriber.onError(FlowableDoOnEach.java:111) at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle$SubscriptionLambdaSubscriber.onError(FlowableDoOnLifecycle.java:85) at io.reactivex.subscribers.SerializedSubscriber.onError(SerializedSubscriber.java:142) at io.reactivex.internal.operators.flowable.FlowableSampleTimed$SampleTimedSubscriber.onError(FlowableSampleTimed.java:93) at io.reactivex.internal.operators.flowable.FlowablePublish$PublishSubscriber.checkTerminated(FlowablePublish.java:403)

zhihuangcao commented 4 years ago

直接在Application onCreate加下面代码

      // 配置全局捕获
        RxJavaPlugins.setErrorHandler(throwable -> {
            if (throwable instanceof UndeliverableException) {
                //do nothing
            } else {
                if (throwable.getMessage() != null) {
                    Log.w("APP", throwable.getMessage());
                }
            }
        });
iqiqx commented 4 years ago

已经解决了。谢谢

everyline commented 4 years ago

已经解决了。谢谢

怎么解决的 用群主提供的方法?