title: Can't use suspend function in RoomDB Dao
body: <p>What is going on with RoomDB and Kotlin coroutines? I am trying, again and again, to use suspend function in Room Dao but every time it shows an error. I even follow the android codelabs example. But it shows an error again. the app doesn't even build if I write suspend in Dao. But if I remove suspend keyword it builds successfully.</p>
  <p>It shows the error below:</p>
  <pre><code>error: Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  kotlin.coroutines.Continuation&lt;? super kotlin.Unit&gt; continuation);
  </code></pre>
  <p>My Entity:</p>
  <pre><code>import androidx.room.Entity
  import androidx.room.PrimaryKey
  
  @Entity(tableName = &quot;vocabulary&quot;)
  class Vocabulary(
      @PrimaryKey(autoGenerate = true)
      val vocabularyId: Long,
      val word: String,
      val meaning: String,
      val definition: String,
      val example: String,
      val partsOfSpeech: String,
      val synonyms: String,
      val antonyms: String,
      val phonetics: String,
      val folderId: Long,
      val isLearned: Int
  )
  </code></pre>
  <p>My Dao:</p>
  <pre><code>import androidx.room.Dao
  import androidx.room.Insert
  import androidx.room.OnConflictStrategy
  
  
  @Dao
  interface VocabuilderDao {
  
      @Insert(onConflict = OnConflictStrategy.IGNORE)
      suspend fun insertVocab(vocabulary: Vocabulary)
  }
  </code></pre>
  <p>My Database class:</p>
  <pre><code>import android.content.Context
  import androidx.room.Database
  import androidx.room.Room
  import androidx.room.RoomDatabase
  
  
  @Database(entities = [Vocabulary::class], version = 1, exportSchema = false)
  public abstract class VocabuilderRoomDb : RoomDatabase(){
  
      abstract fun vocabuilderDao(): VocabuilderDao
  
      companion object{
  
          @Volatile
          private var INSTANCE: VocabuilderRoomDb? = null
  
          fun getRoomDatabase(context: Context): VocabuilderRoomDb{
              return INSTANCE ?: synchronized(this){
                  val instance = Room.databaseBuilder(
                      context.applicationContext,
                      VocabuilderRoomDb::class.java,
                      &quot;vocabuilder_roomdb&quot;
                  ).build()
                  INSTANCE = instance
                  instance
              }
          }
      }
  }
  </code></pre>
  <p>My build.gradle (project level):</p>
  <pre><code>    // Top-level build file where you can add configuration options common to all sub-projects/modules.
      buildscript {
          ext.kotlin_version = '1.6.0'
      
          repositories {
              google()
              mavenCentral()
          }
          dependencies {
              classpath &quot;com.android.tools.build:gradle:7.0.2&quot;
              classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0&quot;
      
              // NOTE: Do not place your application dependencies here; they belong
              // in the individual module build.gradle files
          }
      }
      
      ext {
          activityVersion = '1.2.3'
          appCompatVersion = '1.3.0'
          constraintLayoutVersion = '2.0.4'
          coreTestingVersion = '2.1.0'
          coroutines = '1.5.0'
          lifecycleVersion = '2.3.1'
          materialVersion = '1.3.0'
          roomVersion = '2.3.0'
          // testing
          junitVersion = '4.13.2'
          espressoVersion = '3.1.0'
          androidxJunitVersion = '1.1.2'
      }
      
      
      task clean(type: Delete) {
          delete rootProject.buildDir
      }
  
  My build.gradle(module):
  
  plugins {
      id 'com.android.application'
      id 'kotlin-android'
      id 'kotlin-kapt'
  
  }
  
  android {
      compileSdk 31
  
      defaultConfig {
          applicationId &quot;com.domesoft.vocabuilder&quot;
          minSdk 21
          targetSdk 31
          versionCode 1
          versionName &quot;1.0&quot;
  
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      packagingOptions {
          exclude 'META-INF/atomicfu.kotlin_module'
      }
      kotlinOptions {
          jvmTarget = '1.8'
      }
  }
  
  dependencies {
      implementation &quot;androidx.appcompat:appcompat:$rootProject.appCompatVersion&quot;
      implementation &quot;androidx.activity:activity-ktx:$rootProject.activityVersion&quot;
  
      // Dependencies for working with Architecture components
      // You'll probably have to update the version numbers in build.gradle (Project)
  
      // Room components
      implementation &quot;androidx.room:room-ktx:$rootProject.roomVersion&quot;
      kapt &quot;androidx.room:room-compiler:$rootProject.roomVersion&quot;
      androidTestImplementation &quot;androidx.room:room-testing:$rootProject.roomVersion&quot;
  
      // Lifecycle components
      implementation &quot;androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.lifecycleVersion&quot;
      implementation &quot;androidx.lifecycle:lifecycle-livedata-ktx:$rootProject.lifecycleVersion&quot;
      implementation &quot;androidx.lifecycle:lifecycle-common-java8:$rootProject.lifecycleVersion&quot;
  
      // Kotlin components
      implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
      api &quot;org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines&quot;
      api &quot;org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines&quot;
  
      // UI
      implementation &quot;androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion&quot;
      implementation &quot;com.google.android.material:material:$rootProject.materialVersion&quot;
  
      // Testing
      testImplementation &quot;junit:junit:$rootProject.junitVersion&quot;
      androidTestImplementation &quot;androidx.arch.core:core-testing:$rootProject.coreTestingVersion&quot;
      androidTestImplementation (&quot;androidx.test.espresso:espresso-core:$rootProject.espressoVersion&quot;, {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      androidTestImplementation &quot;androidx.test.ext:junit:$rootProject.androidxJunitVersion&quot;
  }
  </code></pre>