@Database(entities = {User.class}, version = 2, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
public abstract userDao userDao();
}
Класс пользователя Pojo
@Entity
public class User {
@PrimaryKey(autoGenerate = true)
private int id;
public User(){
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
Дао
@Dao
public interface userDao {
@Query("SELECT * FROM User WHERE id = :id")
Flowable<User> get(int id);
@Insert
Completable insert(User user);
}
Зависимости
implementation "androidx.room:room-runtime:2.2.3"
annotationProcessor "androidx.room:room-compiler:2.2.3"
implementation "android.arch.persistence.room:rxjava2:1.1.1"
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation "io.reactivex.rxjava2:rxjava:2.2.14"
Ошибка
error: no suitable method found for createFlowable(RoomDatabase,boolean,String[],<anonymous Callable<User>>)
method RxRoom.createFlowable(RoomDatabase,String...) is not applicable
(varargs mismatch; boolean cannot be converted to String)
method RxRoom.<T>createFlowable(RoomDatabase,String[],Callable<T>) is not applicable
(cannot infer type-variable(s) T
(actual and formal argument lists differ in length))
where T is a type-variable:
T extends Object declared in method <T>createFlowable(RoomDatabase,String[],Callable<T>)
Я пытаюсь выяснить, как работать с rx java в комнате, я следую примерам, но выдает ошибка, в чем проблема? Completable работает отлично