I'm getting this error on running iOS app CMP. I'm trying to implement RoomDB in CMP, well fyi, its ...
b

binayshaw7777

over 1 year ago
I'm getting this error on running iOS app CMP. I'm trying to implement RoomDB in CMP, well fyi, its running in both Android and Desktop perfectly On running for iOS it shows this error and stops the build. Although ,
factory = { DictionaryDatabase::class.instantiateImpl() }
created an error itself but it works fine for all other CMP projects with Room Error:
> Task :composeApp:compileKotlinIosX64
/Users/user/Desktop/KMP/Knowtify/composeApp/src/iosMain/kotlin/database/Database.kt:13:19: error: Type mismatch: inferred type is Unit but RoomDatabase was expected
/Users/user/Desktop/KMP/Knowtify/composeApp/src/iosMain/kotlin/database/Database.kt:13:19: error: Type mismatch: inferred type is Unit but DictionaryDatabase was expected
/Users/user/Desktop/KMP/Knowtify/composeApp/src/iosMain/kotlin/database/Database.kt:13:47: error: Unresolved reference: instantiateImpl

> Task :composeApp:compileKotlinIosX64 FAILED
error: Process 'command '/Users/user/Library/Java/JavaVirtualMachines/openjdk-21.0.1/Contents/Home/bin/java'' finished with non-zero exit value 1

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':composeApp:compileKotlinIosX64'.
> Process 'command '/Users/user/Library/Java/JavaVirtualMachines/openjdk-21.0.1/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.

BUILD FAILED in 14s
8 actionable tasks: 2 executed, 6 up-to-date

** BUILD FAILED **


The following build commands failed:
	PhaseScriptExecution Compile\ Kotlin\ Framework /Users/user/Desktop/KMP/Knowtify/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/Script-F36B1CEB2AD83DDC00CB74D5.sh (in target 'iosApp' from project 'iosApp')
(1 failure)
warning: Run script build phase 'Compile Kotlin Framework' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'iosApp' from project 'iosApp')