Room “Not sure how to convert a Cursor to this method's return type”: which method?

后端 未结 20 1433
遇见更好的自我
遇见更好的自我 2020-12-14 14:15
Error:Not sure how to convert a Cursor to this method\'s return type
Error:Execution failed for task \':app:compileDebugJavaWithJavac\'.
Compilation failed; see the          


        
20条回答
  •  误落风尘
    2020-12-14 14:56

    Modify your Dao, use Flowable instead of observable and add the following dependency (room with rxjava support)

    compile group: 'android.arch.persistence.room', name: 'rxjava2', version: '1.1.1'
    

    Dao returns flowable:

    @Query("SELECT * FROM TableX")
    public abstract Flowable> getAllXs();
    

提交回复
热议问题