Android room persistent: AppDatabase_Impl does not exist

前端 未结 21 1399
日久生厌
日久生厌 2020-11-29 01:09

My app database class

@Database(entities = {Detail.class}, version = Constant.DATABASE_VERSION)
public abstract class AppDatabase extends RoomDatabase {

            


        
21条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 01:23

    make sure to add correct dependency for room in build.gradle

    ext {
       roomVersion = '2.1.0-alpha06'
    }
    
    // Room components
    implementation "androidx.room:room-runtime:$rootProject.roomVersion"
    implementation "androidx.room:room-ktx:$rootProject.roomVersion"
    kapt "androidx.room:room-compiler:$rootProject.roomVersion"
    androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
    

    And below line at the top-

    apply plugin: 'kotlin-kapt'
    

提交回复
热议问题