Android Room throws error: Deletion methods must either return void or return int (the number of deleted rows)

As the error message is trying to tell:

With @Query, you have to change the returned data-type from Completable to int or void.

The Completable would need to subscribe to another method, which runs the method of the Dao:

Completable
  .fromAction(aMethodWhichCallsDao)
  .subscribeOn(Schedulers.single())
  .subscribe();

Or use the @Delete annotation, as @Commonsware suggested (in case this works as advertised).


I don't know if you need this anymore, but just went into the same thing today and found out that you need to use all these 3 libs to create DAOs methods to return Completable:

implementation 'androidx.room:room-runtime:2.2.1'
kapt 'androidx.room:room-compiler:2.2.1'
implementation 'androidx.room:room-rxjava2:2.2.1'

I hope this will help you.