title: Android Room either does not compile or throws error during runtime
body: <p>I wanted to use <em>Room</em> for storing data. For this I have my <code>AppDatabase.kt</code>:</p>
  <pre><code>@Database(entities = [SensorEntry::class], version = 1, exportSchema = false)
  @TypeConverters(Converters::class)
  abstract class AppDatabase : RoomDatabase() {
      abstract fun sensorDao(): SensorDao
  
      companion object {
          // For Singleton instantiation
          @Volatile private var instance: AppDatabase? = null
  
          fun getInstance(context: Context): AppDatabase {
              return instance ?: synchronized(this) {
                  instance ?: buildDatabase(context).also { instance = it }
              }
          }
  
          private fun buildDatabase(context: Context): AppDatabase {
              return Room.databaseBuilder(
                  context,
                  AppDatabase::class.java, &quot;SensorEntry.db&quot;
              )
                  .addTypeConverter(Converters::class)
                  .addCallback(
                      object : RoomDatabase.Callback() {
                          override fun onCreate(db: SupportSQLiteDatabase) {
                              super.onCreate(db)
                              ioThread { getInstance(context).sensorDao() }
                          }
                      }
                  )
                  .build()
          }
      }
  }
  </code></pre>
  <p>using the following dependecies (from [developer.android.com])(<a href="https://developer.android.com/training/data-storage/room" rel="nofollow noreferrer">https://developer.android.com/training/data-storage/room</a>):</p>
  <p><code>build.gradle</code></p>
  <pre><code>dependencies {
      def room_version = &quot;2.4.2&quot;
      implementation &quot;androidx.room:room-runtime:$room_version&quot;
      annotationProcessor &quot;androidx.room:room-compiler:$room_version&quot;
      // optional - RxJava2 support for Room
      implementation &quot;androidx.room:room-rxjava2:$room_version&quot;
      // optional - RxJava3 support for Room
      implementation &quot;androidx.room:room-rxjava3:$room_version&quot;
      // optional - Guava support for Room, including Optional and ListenableFuture
      implementation &quot;androidx.room:room-guava:$room_version&quot;
      // optional - Test helpers
      testImplementation &quot;androidx.room:room-testing:$room_version&quot;
      // optional - Paging 3 Integration
      implementation &quot;androidx.room:room-paging:2.5.0-alpha01&quot;
  }
  </code></pre>
  <p>The database is instanciated in my <code>MainActivity</code></p>
  <pre><code>val db = AppDatabase.getInstance(applicationContext)
  </code></pre>
  <p>I can compile the application but I get the error during runtime which is discussed here:
  <a href="https://stackoverflow.com/questions/46665621/android-room-persistent-appdatabase-impl-does-not-exist">Android room persistent: AppDatabase_Impl does not exist</a></p>
  <pre><code>Caused by: java.lang.RuntimeException: cannot find implementation for AppDatabase. AppDatabase_Impl does not exist
  </code></pre>
  <hr />
  <p>No this thread suggest to replace the <code>annotationProcessor</code> in my <code>gradle.build</code> with <code>kapt</code>.
  This seemed to do the trick, but then I get another error during comiling for which I've already openend a question <a href="https://stackoverflow.com/questions/72434420/using-kotlin-ubyte-for-room-entity-not-working">Using kotlin.UByte for Room Entity not working</a></p>
  <pre><code>C:&lt;...&gt;\UInt8.java:15: error: Cannot find getter for field.
      private byte value;
  Cannot find getter for field.
  </code></pre>
  <p><strong>Update</strong>: I have purposely not included any code of object that should be stored. Please see my other <a href="https://stackoverflow.com/questions/72434420/using-kotlin-ubyte-for-room-entity-not-working">question</a> if you think, this might be the root of the problem.</p>