title: Dao is NULL in room database
body: <p>This is my database class:</p>
  
  <pre><code>@Database(entities = {User.class}, version = 1)
  public abstract class AppDatabase extends RoomDatabase {
      public abstract UserDao userDao();
  }
  </code></pre>
  
  <p>The problem is: <code>userDao()</code> returns null after instantiating a AppDatabase.</p>
  
  <p>This is UserDao:</p>
  
  <pre><code>@Dao
  public interface UserDao {
      @Query("SELECT * FROM user")
      List&lt;User&gt; getAll();
  
      @Query("SELECT * FROM user WHERE id IN (:userIds)")
      List&lt;User&gt; loadAllByIds(int[] userIds);
  
      @Query("SELECT * FROM user WHERE first_name LIKE :first AND "
              + "last_name LIKE :last LIMIT 1")
      User findByName(String first, String last);
  
      @Insert
      void insert(User... users);
  
      @Delete
      void delete(User user);
  
      @Query("SELECT * FROM user ORDER BY last_name ASC")
      LivePagedListProvider&lt;Integer, User&gt; usersByLastName();
  }
  </code></pre>
  
  <p>And this is how I instantiate a database:</p>
  
  <pre><code>AppDatabase database = Room.databaseBuilder(context, AppDatabase.class, "database-name").build();
  </code></pre>
  
  <p>And I'm getting the below exception when trying to call <code>userDao()</code> on AppDatabase instance.</p>
  
  <p>java.lang.RuntimeException: Unable to start activity ComponentInfo{mk.forum/mk.test.MyActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'mk.test.UserDao mk.test.AppDatabase.userDao()' on a null object reference</p>
  
  <p>I'm running this on Moto G5 (Android 7.0), I have no emulator.</p>