https://kotlinlang.org logo
#compose
Title
# compose
h

henrikhorbovyi

07/02/2020, 2:19 AM
Why can't I call
remember
inside an inline function? 🤔
l

Leland Richardson [G]

07/02/2020, 2:48 AM
is the inline function composable?
like other composable functions, remember can only be called inside a composable function
h

henrikhorbovyi

07/02/2020, 2:53 AM
Yeah... It is
l

Leland Richardson [G]

07/02/2020, 6:32 AM
can you paste the code here?
h

henrikhorbovyi

07/02/2020, 4:02 PM
Copy code
@JvmOverloads
@Composable
inline fun <reified T> inject(
    qualifier: Qualifier? = null,
    noinline parameters: ParametersDefinition? = null
): Lazy<T> = remember {
    val context = KoinContextHandler.get()
    context.inject()
}
I'm trying Koin + Compose.
that's the error message
Copy code
e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call 'remember' into
@kotlin.jvm.JvmOverloads @androidx.compose.Composable public inline fun <reified T> inject
l

Leland Richardson [G]

07/02/2020, 4:36 PM
can you try removing
@JvmOverloads
and see if that does anything?
h

henrikhorbovyi

07/02/2020, 4:36 PM
@Leland Richardson [G] My mistake. I added
Copy code
buildFeatures {
    compose true
}
To my compose android module
l

Leland Richardson [G]

07/02/2020, 4:36 PM
ah, and it worked after that?
h

henrikhorbovyi

07/02/2020, 4:37 PM
Cause I'm placing this code into a separated module
That error disappeared and another one came to me 😄
Copy code
.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4

Execution failed for task ':koin-androidx-compose:compileDebugKotlin'.
> Internal compiler error. See log for more details
I'm trying to figure it out
l

Leland Richardson [G]

07/02/2020, 4:41 PM
hmm
i think there are some strange 1.3/1.4 issues we run into because of our compiler version not really being either
if you search this chat some others have run into this and you might find the answer there
you might need to change your stdlib/runtime version
h

henrikhorbovyi

07/02/2020, 4:43 PM
Okay... I'm gonna try to change it
13 Views