I always get this error when rebuild room in ios: ...
# compose-ios
h
I always get this error when rebuild room in ios:
Copy code
Task :composeApp:compileCommonMainKotlinMetadata FAILED
e: file:///Users/mohdhafiz/StudioProjects/katmaans_mobile_frontend/composeApp/src/commonMain/kotlin/com/kloudius/katmaans/data/db/AppDatabase.kt:23:8 Object 'AppDatabaseConstructor' is not abstract and does not implement abstract member 'initialize'.
sample code
Copy code
// The Room compiler generates the `actual` implementations.
@Suppress("NO_ACTUAL_FOR_EXPECT")
expect object AppDatabaseConstructor : RoomDatabaseConstructor<AppDatabase>
Event upgrade library room also the same and running ./gradlew build failed because of this.
g
does it work on Android? in my case I had to override initialize like this
Copy code
expect object AppDatabaseConstructor : RoomDatabaseConstructor<AppDatabase> {
    override fun initialize(): AppDatabase
}
h
@Giorgi it does work in android and ios only things that above error happen when do ./gradlew build
g
hard to say what is really wrong. Have you seen Fruities sample https://github.com/android/kotlin-multiplatform-samples/tree/main/Fruitties? it uses Room and you could compare your implementation to theirs
h
@Giorgi still the same :
@Database(entities = [Fruittie::class], version = 1)
@ConstructedBy(AppDatabaseConstructor::class) abstract class AppDatabase : RoomDatabase() { abstract fun fruittieDao(): FruittieDao } // The Room compiler generates the
actual
implementations. @Suppress("NO_ACTUAL_FOR_EXPECT") expect object AppDatabaseConstructor : RoomDatabaseConstructor<AppDatabase> { override fun initialize(): AppDatabase }
g
can you share the project?
h
@Giorgi project is bigs size and privacy company. how can i shared with you?
g
is it on github? I will give you my username
btw what time zone are you. your replis are at 6 am morning for me 😄
h
btw what time zone are you : GMT+8hr (Malaysia)
is it on github? Answer: it is private bitbucket on park my company