获取整数列表的平均值

时间:2015-08-25 18:51:44

标签: android rx-java rx-android

我刚开始使用RxJava,这是我的代码:

Observable<Integer> averageObservable = 
MathObservable.averageInteger(Observable.just(11, 2, 3, 4, 5));

这是我的错误:

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:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.NoSuchMethodError: No static method identity()Lrx/functions/Func1; in class Lrx/functions/Functions; or its super classes (declaration of 'rx.functions.Functions' appears in /data/app/de.asideas.images-2/base.apk)
            at rx.observables.MathObservable.averageInteger(MathObservable.java:89)
            at de.asideas.images.ui.GitHubChallengeFragment$2.call(GitHubChallengeFragment.java:81)
            at de.asideas.images.ui.GitHubChallengeFragment$2.call(GitHubChallengeFragment.java:61)
            at rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:55)
            at rx.internal.operators.OperatorMerge$InnerSubscriber.emit(OperatorMerge.java:676)
            at rx.internal.operators.OperatorMerge$InnerSubscriber.onNext(OperatorMerge.java:586)
            at retrofit.RxSupport$2.run(RxSupport.java:56)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: rx.exceptions.OnErrorThrowable$OnNextValue: OnError while emitting onNext value: java.util.ArrayList.class
            at rx.internal.operators.OperatorMerge$InnerSubscriber.emit(OperatorMerge.java:679)
            at rx.internal.operators.OperatorMerge$InnerSubscriber.onNext(OperatorMerge.java:586)
            at retrofit.RxSupport$2.run(RxSupport.java:56)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:818)

0 个答案:

没有答案