when I run my app I am getting an error message in build
C:\Users\sachi\Desktop\androidproject\sleepandroid\app\build\tmp\kapt3\stubs\debug\com\example\sleepandroid\data\db\SleepDatabase.java:19: error: cannot find symbol
public abstract SleepClassifyEventDao sleepClassifyEventDao();
^
symbol: class SleepClassifyEventDao
location: class SleepDatabaseC:\Users\sachi\Desktop\androidproject\sleepandroid\app\build\tmp\kapt3\stubs\debug\com\example\sleepandroid\data\SleepRepository.java:15: error: cannot find symbol
private final SleepClassifyEventDao sleepClassifyEventDao = null;
^
symbol: class SleepClassifyEventDao
location: class SleepRepositoryC:\Users\sachi\Desktop\androidproject\sleepandroid\app\build\tmp\kapt3\stubs\debug\com\example\sleepandroid\data\SleepRepository.java:69: error: cannot find symbol
SleepClassifyEventDao sleepClassifyEventDao) {
^
symbol: class SleepClassifyEventDao
location: class SleepRepositoryC:\Users\sachi\Desktop\androidproject\sleepandroid\app\build\tmp\kapt3\stubs\debug\com\example\sleepandroid\data\db\SleepDatabase.java:10: error: [RoomProcessor:MiscError] androidx.room.RoomProcessor was unable to process this class because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
these classes exist in those classes so why I am getting this error
this is my SleepDatabase kotlin class
SleepDatabase.kt
package com.example.sleepandroid.data.db;
import java.lang.System;
@androidx.room.Database(entities = {com.example.sleepandroid.data.db.SleepSegmentEventEntity.class, com.example.sleepandroid.data.db.SleepClassifyEventEntity.class}, version = 3, exportSchema = false)
@kotlin.Metadata(mv = {1, 4, 2}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\'\u0018\u0000 \u00072\u00020\u0001:\u0001\u0007B\u0005\u00a2\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H&J\b\u0010\u0005\u001a\u00020\u0006H&\u00a8\u0006\b"}, d2 = {"Lcom/example/sleepandroid/data/db/SleepDatabase;", "Landroidx/room/RoomDatabase;", "()V", "sleepClassifyEventDao", "LSleepClassifyEventDao;", "sleepSegmentEventDao", "Lcom/example/sleepandroid/data/db/SleepSegmentEventDao;", "Companion", "app_debug"})
public abstract class SleepDatabase extends androidx.room.RoomDatabase {
private static volatile com.example.sleepandroid.data.db.SleepDatabase INSTANCE;
@org.jetbrains.annotations.NotNull()
public static final com.example.sleepandroid.data.db.SleepDatabase.Companion Companion = null;
@org.jetbrains.annotations.NotNull()
public abstract com.example.sleepandroid.data.db.SleepSegmentEventDao sleepSegmentEventDao();
@org.jetbrains.annotations.NotNull()
public abstract SleepClassifyEventDao sleepClassifyEventDao();
public SleepDatabase() {
super();
}
@kotlin.Metadata(mv = {1, 4, 2}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002\u00a2\u0006\u0002\u0010\u0002J\u000e\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0006\u001a\u00020\u0007R\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0082\u000e\u00a2\u0006\u0002\n\u0000\u00a8\u0006\b"}, d2 = {"Lcom/example/sleepandroid/data/db/SleepDatabase$Companion;", "", "()V", "INSTANCE", "Lcom/example/sleepandroid/data/db/SleepDatabase;", "getDatabase", "context", "Landroid/content/Context;", "app_debug"})
public static final class Companion {
@org.jetbrains.annotations.NotNull()
public final com.example.sleepandroid.data.db.SleepDatabase getDatabase(@org.jetbrains.annotations.NotNull()
android.content.Context context) {
return null;
}
private Companion() {
super();
}
}
}
this is my SleepClassifyEventDao kotlin class
SleepClassifyEventDao.kt
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.example.sleepandroid.data.db.SleepClassifyEventEntity
import kotlinx.coroutines.flow.Flow
@Dao
interface SleepClassifyEventDao {
@Query("SELECT * FROM sleep_classify_events_table ORDER BY time_stamp_seconds DESC")
fun getAll(): Flow<List<SleepClassifyEventEntity>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(sleepClassifyEventEntity: SleepClassifyEventEntity)
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAll(sleepClassifyEventEntities: List<SleepClassifyEventEntity>)
@Delete
suspend fun delete(sleepClassifyEventEntity: SleepClassifyEventEntity)
@Query("DELETE FROM sleep_classify_events_table")
suspend fun deleteAll()
}
this is my SleepRepository kotlin class
SleepRepository.kt
package com.example.sleepandroid.data
import SleepClassifyEventDao
import com.example.sleepandroid.data.datastore.SleepSubscriptionStatus
import com.example.sleepandroid.data.db.SleepClassifyEventEntity
import com.example.sleepandroid.data.db.SleepSegmentEventDao
import com.example.sleepandroid.data.db.SleepSegmentEventEntity
import kotlinx.coroutines.flow.Flow
class SleepRepository(
private val sleepSubscriptionStatus: SleepSubscriptionStatus,
private val sleepSegmentEventDao: SleepSegmentEventDao,
private val sleepClassifyEventDao: SleepClassifyEventDao) {
val subscribedToSleepDataFlow: Flow<Boolean> = sleepSubscriptionStatus.subscribedToSleepDataFlow
suspend fun updateSubscribedToSleepData(subscribedToSleepData: Boolean) =
sleepSubscriptionStatus.updateSubscribedToSleepData(subscribedToSleepData)
val allSleepSegmentEvents: Flow<List<SleepSegmentEventEntity>> =
sleepSegmentEventDao.getAll()
suspend fun insertSleepSegment(sleepSegmentEventEntity: SleepSegmentEventEntity) {
sleepSegmentEventDao.insert(sleepSegmentEventEntity)
}
suspend fun insertSleepSegments(sleepSegmentEventEntities: List<SleepSegmentEventEntity>) {
sleepSegmentEventDao.insertAll(sleepSegmentEventEntities)
}
val allSleepClassifyEvents: Flow<List<SleepClassifyEventEntity>> =
sleepClassifyEventDao.getAll()
suspend fun insertSleepClassifyEvent(sleepClassifyEventEntity: SleepClassifyEventEntity) {
sleepClassifyEventDao.insert(sleepClassifyEventEntity)
}
suspend fun insertSleepClassifyEvents(sleepClassifyEventEntities: List<SleepClassifyEventEntity>) {
sleepClassifyEventDao.insertAll(sleepClassifyEventEntities)
}
}
my Gradle dependencies
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
// Required for new permission APIs
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
implementation 'androidx.activity:activity-ktx:1.2.0-rc01'
// Room components
implementation "androidx.room:room-ktx:2.2.6"
implementation 'androidx.room:room-runtime:2.2.6'
kapt "androidx.room:room-compiler:2.2.6"
androidTestImplementation "androidx.room:room-testing:2.2.6"
// DataStore components
implementation "androidx.datastore:datastore-preferences:1.0.0-alpha06"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
// Kotlin components
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2"
// Play services library required for activity recognition.
implementation 'com.google.android.gms:play-services-location:18.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}