humazed / RoomAsset

A helper library to help using Room with existing pre-populated database [DEPRECATED].
Apache License 2.0
135 stars 23 forks source link

Compatibility with Room v 1.1.1 ? #20

Open mrahimygk opened 5 years ago

mrahimygk commented 5 years ago

With this error:

constructor RoomOpenHelper in class RoomOpenHelper cannot be applied to given types; required: DatabaseConfiguration,Delegate,String found: DatabaseConfiguration,,String,String reason: actual and formal argument lists differ in length

and by this initialization:

RoomAsset.databaseBuilder(context!!.applicationContext, MyDatabase::class.java, "appname.v4.db") .fallbackToDestructiveMigration() .build()

I think there might be a difference between the constructor in Room and the one this lib is using.

Thanks for the great work.

ueen commented 5 years ago

Works great, if set up correctly, which is not easy, as Room is quite complicated starting out. Maybe follow this tutorial https://www.youtube.com/watch?v=ARpn-1FPNE4 and read the instructions on how to implement RoomAsset! And you know, that you must pass an actual class, right? Like this RoomAsset.databaseBuilder(context!!.applicationContext, MyDatabase.class, "appname.v4.db") .fallbackToDestructiveMigration() .build() And the Class musst be a Room Database (obviously).

ueen commented 5 years ago

Also you probably don't want to use .fallbackToDestructiveMigration() as it drops all rows, which renders importing a pre-populated database useless, this should be closed.

SGL-IGiS commented 5 years ago

HEllo there, same issue found Failed to resolve: com.github.humazed:RoomAsset:1.0.3 with Room v 1.1.1, how can i resolve ??

kazemihabib commented 4 years ago

Hi, Room now supports using a pre-packaged database out of the box, since version 2.2.0 Check this answer https://stackoverflow.com/a/57922686/4146943