개발/Compose

RuntimeException - Shortly: The required symbol androidx.compose.runtime/remember

귀염둥이 팡무 2023. 8. 7. 15:29

컴포즈 멀티플랫폼으로 개발하다보면 아래의 컴파일 오류를 만나는 경우가 있습니다.

Shortly: The required symbol androidx.compose.runtime/remember|1835138394250687683[0] is missing in the module or module dependencies. This could happen if the required dependency is missing in the project. Or if there is a dependency that has a different version (without the required symbol) in the project than the version (with the required symbol) that the module was initially compiled with.

 * Source files: 
 * Compiler version info: Konan: 1.8.21 / Kotlin: 1.8.21
 * Output kind: FRAMEWORK

error: java.lang.RuntimeException: Failed to compute the detailed error message. See the root cause exception.

Shortly: The required symbol androidx.compose.runtime/remember|1835138394250687683[0] is missing in the module or module dependencies. This could happen if the required dependency is missing in the project. Or if there is a dependency that has a different version (without the required symbol) in the project than the version (with the required symbol) that the module was initially compiled with.
    at org.jetbrains.kotlin.backend.common.serialization.linkerissues.SignatureIdNotFoundInModuleWithDependencies.<init>(KotlinIrLinkerIssues.kt:80)
    at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.deserializeOrReturnUnboundIrSymbolIfPartialLinkageEnabled(KotlinIrLinker.kt:84)
    at org.jetbrains.kotlin.backend.common.serialization.FileDeserializationState$symbolDeserializer$3.invoke(IrFileDeserializer.kt:78)
    at org.jetbrains.kotlin.backend.common.serialization.FileDeserializationState$symbolDeserializer$3.invoke(IrFileDeserializer.kt:77)
    at org.jetbrains.kotlin.backend.common.serialization.IrSymbolDeserializer.deserializeIrSymbolData(IrSymbolDeserializer.kt:67)
    at org.jetbrains.kotlin.backend.common.serialization.IrSymbolDeserializer.deserializeIrSymbol(IrSymbolDeserializer.kt:84)

위의 androidx.compose.runtime/remember 오류가 아니더라도 컴포즈 기능과 관련된 내용의 오류가 발생할 수 있습니다. 이를 해결하기 위해서는 gradle.propertiescacheKind 값을 none으로 지정하고 sync 해주시면 깔끔하게 해결 가능합니다!

kotlin.native.cacheKind=none

개인적인 추측으로는 Kotlin/Native에서 빠른 컴파일을 위해 caching 옵션이 full로 되어있는데, 이 cache로 인하여 충돌이 발생하지 않았나 싶습니다.