本文介绍了带有Completable的Android房间插入无法正常工作?用@insert注释的方法可以返回void,long?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的版本是

implementation 'io.reactivex.rxjava2:rxjava:2.2.4'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation 'android.arch.persistence.room:runtime:2.1.0-alpha04'
kapt 'android.arch.persistence.room:compiler:2.1.0-alpha04'
implementation 'android.arch.persistence.room:rxjava2:2.1.0-alpha04'

道是

@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertStore(stores: Stores): Completable

推荐答案

来自这篇很棒的文章在媒介上,我发现了

From this great article on medium, i found that;

即使我使用的是最新版本的房间,

Even though i was using the latest version of the room i was having the issue,

implementation 'android.arch.persistence.room:runtime:2.1.0-alpha04'
kapt 'android.arch.persistence.room:compiler:2.1.0-alpha04'
implementation 'android.arch.persistence.room:rxjava2:2.1.0-alpha04'

我发现此问题是由于在项目中使用androidx而发生的,因此,为了解决这一问题,我不得不使用androidx房间组件.

I found the issue was occuring because of using androidx in my project, so in order to fix that i had to use androidx room components.

implementation 'androidx.room:room-runtime:2.1.0-alpha04'
kapt 'androidx.room:room-compiler:2.1.0-alpha04'
implementation 'androidx.room:room-rxjava2:2.1.0-alpha04'

这篇关于带有Completable的Android房间插入无法正常工作?用@insert注释的方法可以返回void,long?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 12:48