About the 11. Databases and the Room Library category

(Replace this first paragraph with a brief description of your new category. This guidance will appear in the category selection area, so try to keep it below 200 characters.)

Use the following paragraphs for a longer description, or to establish category guidelines or rules:

  • Why should people use this category? What is it for?

  • How exactly is this different than the other categories we already have?

  • What should topics in this category generally contain?

  • Do we need this category? Can we merge with another category, or subcategory?

The code that came with the book for chapter 11 is not working. Room.databaseBuilder always sets the database field to null. The criminalIntent application is always empty.
I had uploaded the databases folder as mentioned in the book. I debug the application and found database variable is always set to null. The room library is not able to access the crime-database.
Can anyone help me with this. Why am I not seeing the data pulled from the database.

I had the same issue.and the way I went about it was by upgrading the Android API on the emulator to the target API. The original api I was using was 25 and I updated to 29, both cases on a pixel 3. It also worked w/o any issues on my sony Experia which was running a Android Oreo.

I know that it doesn’t fix the problem that it doesn’t work for an older API, in this case 25, but I hope this helps to move along with the exercise – which what I was focus on.

I was having the same issue, updated to API 29 and it worked. Problem is I want to be able to use what I learn in the book for an actual sellable app. Can’t sell an app that only works on api 29???

I followed the suggestions listed in this thread and updated the API to target API 30 from 29 but I still keeping seeing the blank screen. It didn’t work on 29 as well as 30.

I did this assignment a few months ago and got it to work by upping the api to 29, but i am now revisiting this assignment and it is not working. has anyone had this issue and then continued forward to find that that the database starts working in later chapters?

right now i have decided to try updated everything. i’m hoping this will work.

I think you have missed the suggestion. It is not suggested that you change the target in the gradle file, but that you change your emulator to the target.