RxAndroid Room Flowable noClassDefError

时间:2018-06-20 07:35:51

标签: android android-room

我需要处理Flowable<List<Object>>返回的ObjectDao

DAO

@Dao
public interface DefectosDao
{
@Insert(onConflict = OnConflictStrategy.IGNORE)
void insertarDefectos(DefectoEntity defectos);

@Query("select * from defectos where cod_defecto = :cod")
Maybe<DefectoEntity> getByCod(String cod);

@Query("select * from defectos where pt = 1")
Maybe<List<DefectoEntity>> getPt();

@Query("select * from defectos where ct = 1")
Maybe<List<DefectoEntity>> getCt();

@Query("select * from defectos where apoyo = 1")
Flowable<List<DefectoEntity>> getApoyo();
}

处理程序

DataBase.getAppDatabase(Splash_Screen.this).Defecto().getApoyo()
                    .subscribeOn(Schedulers.newThread())
                    .observeOn(Schedulers.io())
                    .subscribe(item2->{
                        System.out.println(item2);});

错误

06-20 09:15:18.340 16255-16445/com.rpr.pronamic.rpr E/UncaughtException: io.reactivex.exceptions.UndeliverableException: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/arch/core/executor/AppToolkitTaskExecutor;
    at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
    at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69)
    at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
    at java.lang.Thread.run(Thread.java:761)
 Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/arch/core/executor/AppToolkitTaskExecutor;
    at android.arch.persistence.room.RxRoom$5$1.schedule(RxRoom.java:136)
    at io.reactivex.Scheduler$Worker.schedule(Scheduler.java:372)
    at io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.trySchedule(FlowableObserveOn.java:166)
    at io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.request(FlowableObserveOn.java:143)
    at io.reactivex.internal.subscribers.BasicFuseableConditionalSubscriber.request(BasicFuseableConditionalSubscriber.java:152)
    at io.reactivex.internal.subscribers.BasicFuseableSubscriber.request(BasicFuseableSubscriber.java:153)
    at io.reactivex.internal.subscribers.BasicFuseableSubscriber.request(BasicFuseableSubscriber.java:153)
    at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.requestUpstream(FlowableSubscribeOn.java:133)
    at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.onSubscribe(FlowableSubscribeOn.java:90)
    at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onSubscribe(BasicFuseableSubscriber.java:67)
    at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onSubscribe(BasicFuseableSubscriber.java:67)
    at io.reactivex.internal.subscribers.BasicFuseableConditionalSubscriber.onSubscribe(BasicFuseableConditionalSubscriber.java:66)
    at io.reactivex.internal.operators.flowable.FlowableObserveOn$ObserveOnConditionalSubscriber.onSubscribe(FlowableObserveOn.java:530)
    at io.reactivex.internal.operators.flowable.FlowableCreate.subscribeActual(FlowableCreate.java:70)
    at io.reactivex.Flowable.subscribe(Flowable.java:14349)
    at io.reactivex.internal.operators.flowable.FlowableObserveOn.subscribeActual(FlowableObserveOn.java:53)
    at io.reactivex.Flowable.subscribe(Flowable.java:14349)
    at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:36)
    at io.reactivex.Flowable.subscribe(Flowable.java:14349)
    at io.reactivex.internal.operators.flowable.FlowableFilter.subscribeActual(FlowableFilter.java:37)
    at io.reactivex.Flowable.subscribe(Flowable.java:14349)
    at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:38)
    at io.reactivex.Flowable.subscribe(Flowable.java:14349)
    at io.reactivex.Flowable.subscribe(Flowable.java:14295)
    at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
    at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
    at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
    at java.lang.Thread.run(Thread.java:761) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.core.executor.AppToolkitTaskExecutor" on path: DexPathList[[zip file "/data/app/com.rpr.pronamic.rpr-1/base.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.rpr.pronamic.rpr-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.rpr.pronamic.rpr-1/lib/arm64, /system/fake-libs64, /data/app/com.rpr.pronamic.rpr-1/base.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.rpr.pronamic.rpr-1/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

我尝试过使用Maybe对象和Single对象,但没错。

进口

implementation 'io.reactivex.rxjava2:rxjava:2.1.14'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'android.arch.persistence.room:runtime:1.1.0'
implementation 'android.arch.persistence.room:rxjava2:1.0.0-alpha5'
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.0'

我尝试使用 RxJava 版本 1.0.1 2.0.1 -相同的问题。

0 个答案:

没有答案