RecyclerView: No adapter attached; skipping layout

When trying to run the code of the app after implementing Listing 24.5, I am getting the error listed in the description of this topic.

I assume this error comes from the fact that the adapter is only set in onViewCreated.
How can it be fixed in the nicest way?

Should we move all RecyclerView set-up to onCreateView (including the start of the LiveData observation)?
Alternatively, initialize the adapter in onCreateView with an emptylist?

I followed the instructions from the book, starting from the beginning of chapter 24. I ran the code after implementing Listing 24.5. I was able to run it without any crashes. I do see the error that you are seeing in Android Studio’s Logcat (E/RecyclerView: No adapter attached; skipping layout). The reason you get this error is because you haven’t set up the RecyclerView’s adapter yet, which will be done later in the chapter.

You set up the RecyclerView.Adapter later on in Listing 24.34 and Listing 24.35, so the error should go away after these steps, in theory.

Running the app at this point in the chapter is just an intermediate step to make sure that you have set everything up correctly. If the app was crashing at this point, then you know you followed the instructions incorrectly.