I'm getting this error on running iOS app CMP. I'm...
# compose-ios
b
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:
Copy code
> 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')
j
b
Thanks @John O'Reilly, but I think I've followed everything you shared in your repo. But this is something else, people are stackoverflow are saying to upgrade kotlin and composeCompiler version. Idk what to do right now. I'm trying to build your repo by downgrading agp to
8.3.2
first.
This what I see when running ios from XCode 15.3
c
I show how to set this up in this stripped down example app: https://github.com/realityexpander/KMP_Room

https://youtu.be/2E-3FDRPmYI

🔥 1
b
Thanks @Chris Athanas 😁 it got resolved that day.
💯 1
254 Views