New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RoomAsset does not seem to load Database [request for help] #3
Comments
did you put the DB file in |
Yes, I should have written it in the text of the issue, but it is the comments to the code. File tasksdb.db is in src/main/assets/databases. However if I use |
okay, I will take a look and fix the issue, in one hour max I hope. |
Thank you, however I am not sure if it is a problem of your code, hence I tagged this question as a [request for help]. Since no support page is provided I had to use github issues. Probably I am doing something wrong, I am wondering if I have missed something in my build.gradle or somewhere. |
No, in the last version of Room the Android team have introduced some changes which break the lib, but it's easy to fix, so I will fix them first since I don't see you have made a mistake. |
Ok, thank you again for yor help. When you have finished let me know which version to use in my
line of the build.gradle file, or post the version number in the github release page. |
I was mistaken the new changes didn't affect the database but only the sample project so I updated the sample. I have tried your code and it's working for me. my guess is that you used empty DB first then tried to use wrong names. but didn't change the version so RoomAsset didn't look at the asset folder hence no exception is thrown. so I need you to uninstall your app and try again. |
That is great, my mistake! It now works. So RoomAsset only looks in the assets folder the first time the app is run, correct? Is there any way to force it to look again? Should I increase the version number and add a migration? |
yes, it will be wasteful to look every time the app starts, so the only way is to increase the version and to add a migration. |
Hello,
first let me thank you for creating this package that I find really helpful. However I cannot seem to make it work. It seems to me that the database is not loaded, since any query returns nothing, although the database is populated.
Furthermore, nothing in the console says that the database was loaded, and the same thing happens if I change the name parameter of RoomAsset.databaseBuilder() to a dummy name of a non-existent file. No exceptions are ever thrown and the app does not crash.
TL;DR: regardless of the name of the DB I give to RoomAsset.databaseBuilder(), I get no exceptions but all queries return nothing as if the DB was not populated.
This is my database class file in Java:
This is how the DB is created and queried in an activity
In my build.gradle for the app module is:
and in my root build.gradle I added maven to the repositories as you explained in the readme.
What is wrong?
The text was updated successfully, but these errors were encountered: