-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS Doesn't build with kotlin 2.1.0 and voyager 1.1.0-beta03 or lower #515
Comments
I updated kotlin to 2.1.0 in #514 |
@zeeshanali-k Removing the voyager koin dependency and recreating the koinScreenModel(...) function will fix your issue
@dzmpr Your branch does not fix the issue |
I'm not intended to fix this problem. @zeeshanali-k requested to update kotlin in project and I just highlighted that this was done in my PR. |
Same issue here, here is the stacktrace Showing All Messages CALL 'public abstract fun (<set-?>: T of kotlinx.coroutines.flow.MutableStateFlow): kotlin.Unit declared in kotlinx.coroutines.flow.MutableStateFlow' type=kotlin.Unit origin=EQ $this: CALL 'internal final fun (): kotlinx.coroutines.flow.MutableStateFlow<kotlin.String?{ cafe.adriel.voyager.core.model.ScreenModelKey? }> declared in cafe.adriel.voyager.core.model.ScreenModelStore' type=kotlinx.coroutines.flow.MutableStateFlow<kotlin.String?{ cafe.adriel.voyager.core.model.ScreenModelKey? }> origin=GET_PROPERTY
<set-?>: GET_VAR 'val key: kotlin.String{ cafe.adriel.voyager.core.model.ScreenModelKey } [val] declared in cafe.adriel.voyager.koin.koinScreenModel' type=kotlin.String{ cafe.adriel.voyager.core.model.ScreenModelKey } origin=null
at org.jetbrains.kotlin.ir.interpreter.transformer.IrConstEvaluationContext.canBeInterpreted(IrConstEvaluationContext.kt:74)
Caused by: java.lang.IllegalStateException: Parent of this declaration is not a class: CONSTRUCTOR MISSING_DECLARATION visibility:public <> () returnType:kotlin.Nothing
|
same here problem in android so far ok |
Any updates on it? iOS build is blocked with these versions. |
@esdras-ajulabs there is a workaround in #515 (comment) |
@edgarsMalahovskis why not fix this inside library itself instead of manual create own class? is there difficult or blocking to update the library? |
@hafiz013 I agree with you, but people need to work while this library is updated, so there is a workaround. Not saying that this should not be fixed. |
Unfortunately, it didn't fix the issue. Showing All Issues $this: CALL 'internal final fun (): kotlinx.coroutines.flow.MutableStateFlow<kotlin.String?{ cafe.adriel.voyager.core.model.ScreenModelKey? }> declared in cafe.adriel.voyager.core.model.ScreenModelStore' type=kotlinx.coroutines.flow.MutableStateFlow<kotlin.String?{ cafe.adriel.voyager.core.model.ScreenModelKey? }> origin=GET_PROPERTY
<set-?>: GET_VAR 'val key: kotlin.String{ cafe.adriel.voyager.core.model.ScreenModelKey } [val] declared in .koinScreenModel' type=kotlin.String{ cafe.adriel.voyager.core.model.ScreenModelKey } origin=null |
@esdras-ajulabs What did you do exactly to fix this issue? Can you walk through your code? |
Hi, does it mean that I can't use koin with voyager anymore? I was trying to remove voyager-koin dependency and just copied koinScreenModel to my project, but still got the same issue. |
@DevSrSouza could you please take a look when you have time? It’s just been quite a while since Kotlin 2.1.0 was released |
thanks @DevSrSouza . This one quite important. |
Any updates on this? |
make sure you don't use rememberScreenModel anywhere in your code. Use viewModel from compose multiplatform
or @Composable
inline fun <reified VM : ViewModel> rememberViewModel(key: String? = VM::class.multiplatformName): VM {
val di = localDI()
return viewModel(
key = key,
modelClass = VM::class,
factory = viewModelFactory { initializer { di.inject<VM>() } }
)
}
with ViewModel
|
I found one solution. I had 2 projects. kotlin version 2.1.0 on both of them. one is compiling on iOS, other not )). then searched difference. there is only one difference: compiling app implemented rinku (https://github.com/theolm/Rinku) lib (version 1.3.2). I added this app to next one, now it is compiling on iOS also )). ridiculously solution but working )) |
When I set my KMP project's Kotlin version to 2.1.0 and then run the iOS build I get following error, although if I set the kotlin version to lower than that like 2.0.21, everything works fine.
Also setting cacheKind=none doesn't work.
So please support Kotlin 2.1.0 ASAP, as the lower versions of kotlin don't support the latest xcode, so I am currently using xcode 15 and often switching between 16 and 15. Just because of this voyager error.
error: Failed to build cache for /{root}/.gradle/caches/modules-2/files-2.1/cafe.adriel.voyager/voyager-koin-iossimulatorarm64/1.1.0-beta03/5b6d910be8bdced3277bf6e86300f0790ddc4209/voyager-koin.
As a workaround, please try to disable compiler caches (kotlin.native.cacheKind=none)
The text was updated successfully, but these errors were encountered: