I'm trying to use expect/actual to generate the `c...
# multiplatform
p
I'm trying to use expect/actual to generate the
createDatabaseBuilder()
method which is platform dependent. I placed it in my
Database.kt
file:
Copy code
expect fun createDatabaseBuilder(): RoomDatabase.Builder<Database>
I placed the actual fun createDatabaseBuilder() on the same
Database.kt
file with the same name and the same package but in the
desktopMain
platform, but I'm getting this exception when building:
Database.kt:1:1 Duplicate JVM class name 'com/package/myapp/data/datasource/local/DatabaseKt' generated from: DatabaseKt, DatabaseKt
I got this exception in both classes with the same name, the one placed in commonMain and the one placed in desktopMain. If I rename the desktopMain class to
Database.jvm.kt
class, then it works. Why is necessary to add that .jvm on the actual class? I'm using expect actual for some other functionalities of the application and I didn't have this issue on them. In these cases I'm using also the same package and the same file name, without the jvm, and it doesn't give this error. I checked the documentation about using expect/actual in multiplaform, and can't find the explanation of this.