BigDX
BigDX

Reputation: 3547

Error when building Android Room Database in class RoomOpenHelper

I am following this example here and integrating it into my current app I am developing. I had previous sql databases but I am not trying to migrate them.

I have the libraries setup and all the code in but when i try to build to test on emulator i get this error.

Error:(27, 60) error: constructor RoomOpenHelper in class RoomOpenHelper cannot be applied to given types;
required: DatabaseConfiguration,Delegate,String,String
found: DatabaseConfiguration,<anonymous Delegate>,String
reason: actual and formal argument lists differ in length

It seems the 'RoomOpenHelper' needs a identityHash and legacyHash. the legacy has is not provided and I cannot figure out why.

Here are the libraries I am using

implementation "android.arch.lifecycle:runtime:1.1.0"
implementation "android.arch.lifecycle:extensions:1.1.0"
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"

implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
compile "android.arch.persistence.room:rxjava2:1.1.0-alpha1"

implementation "android.arch.lifecycle:common-java8:1.1.0"

I have tried with and without the common java8 library.

Upvotes: 2

Views: 1270

Answers (2)

Idee
Idee

Reputation: 1977

It usually caused by variations in room dependencies. Make sure the normal dependency, the annotation dependency, and rxjava support dependency are all in the same version.

Upvotes: 1

BigDX
BigDX

Reputation: 3547

I fixed this by updating the 2 persistence libraries to a 1.1.0 alpha build

Upvotes: 5

Related Questions