Hi. I'm using Rick's `KMMViewModel` library but i'...
# multiplatform
a
Hi. I'm using Rick's
KMMViewModel
library but i'm facing an issue. This is the ViewModel
Copy code
open class BaseViewModel : KMMViewModel() {

    protected val loadingOverlayMutable = MutableStateFlow<LoadingOverlayState>(viewModelScope, LoadingOverlayState.NotLoading)

    @NativeCoroutinesState
    val loadingOverlay = loadingOverlayMutable.asStateFlow()

    protected fun setLoadingState(){
        loadingOverlayMutable.value = LoadingOverlayState.Loading
    }

    protected fun setNotLoadingState(){
        loadingOverlayMutable.value = LoadingOverlayState.NotLoading
    }

}
and i'm getting the next error on the line where i instantaite the
MutableStateFlow
BaseViewModel.kt:11:43 Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
I have
Copy code
compileOptions {
    coreLibraryDesugaringEnabled true
    sourceCompatibility JavaVersion.VERSION_17
    targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
        jvmTarget = "17"
    }
}
And also in Settings -> Build,Execution,Deployment -> Build Tools -> Gradle ... i have set Gradle JDK 17 I have no idea where the 11 and 1.8 are coming from. I'm guessing one's coming form his library, but the other ?! I've spent HOURS now on this ... it's driving me crazy ! c.c. @Rick Clephas ? 😄
r
Hi. Yeah the 11 is coming from KMM-ViewModel. So if I understand this error correctly that means BaseViewModel is using 1.8. Do you have a public reproducer by any chance?
l
You should be able to suppress by adding
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")
Not ideal though as it ends up being added to every ViewModel
a
@Rick Clephas unfortunately I don't, we can do a TeamViewer session so you can play around with it if you want 😄 😄 But ... it's really strange ... why would it say 1.8 when I'm using 17 ?! I've change it in all of the common suspected places (mentioned them in the original post) ... I wonder if i can specify it somewhere else... @Luka Mišković oh, that would not be a problem for now. i'm blocking iOS at the moment, so I'll take whatever i get.