Reputation: 561
I have updated my project to Kotlin 1.6.10, Compose 1.1.0-rc01 and compose compiler to 1.1.0-rc02, because I need some new features in Compose.
During compilation I have now this error, any solution ? It was working with Kotlin 1.5.31, Compose/Compose compiler 1.0.5
java.lang.IllegalStateException: Symbol for kotlin.collections/mutableMapOf|-4813910536206556932[0] is unbound
at org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.getOwner(IrPublicSymbolBase.kt:52)
at org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionPublicSymbolImpl.getOwner(IrPublicSymbolBase.kt:74)
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer.visitCall(LiveLiteralTransformer.kt:663)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:199)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:24)
at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:47)
at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:33)
at org.jetbrains.kotlin.ir.expressions.IrExpressionBody.transformChildren(IrBody.kt:46)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBody(IrElementTransformerVoid.kt:108)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpressionBody(IrElementTransformerVoid.kt:114)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpressionBody(IrElementTransformerVoid.kt:115)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpressionBody(IrElementTransformerVoid.kt:24)
at org.jetbrains.kotlin.ir.expressions.IrExpressionBody.accept(IrBody.kt:36)
at org.jetbrains.kotlin.ir.expressions.IrExpressionBody.transform(IrBody.kt:39)
at org.jetbrains.kotlin.ir.declarations.IrField.transformChildren(IrField.kt:41)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitField(IrElementTransformerVoid.kt:81)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitField(IrElementTransformerVoid.kt:82)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitField(IrElementTransformerVoid.kt:24)
at org.jetbrains.kotlin.ir.declarations.IrField.accept(IrField.kt:34)
at org.jetbrains.kotlin.ir.IrElement$DefaultImpls.transform(IrElement.kt:32)
at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:19)
at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35)
at org.jetbrains.kotlin.ir.declarations.IrClass.transformChildren(IrClass.kt:66)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClass(IrElementTransformerVoid.kt:66)
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer.access$visitClass$s780614737(LiveLiteralTransformer.kt:158)
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer$visitClass$1.invoke(LiveLiteralTransformer.kt:466)
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer$visitClass$1.invoke(LiveLiteralTransformer.kt:465)
at androidx.compose.compiler.plugins.kotlin.lower.DurableKeyVisitor.siblings(DurableKeyVisitor.kt:117)
at androidx.compose.compiler.plugins.kotlin.lower.DurableKeyVisitor$siblings$1.invoke(DurableKeyVisitor.kt:131)
at androidx.compose.compiler.plugins.kotlin.lower.DurableKeyVisitor.enter(DurableKeyVisitor.kt:96)
at androidx.compose.compiler.plugins.kotlin.lower.DurableKeyVisitor.siblings(DurableKeyVisitor.kt:131)
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer.siblings(LiveLiteralTransformer.kt:194)
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer.visitClass(LiveLiteralTransformer.kt:465)
etc.....```
Upvotes: 34
Views: 8813
Reputation: 370
Upgrading the Kotlin version fixed my problem. While upgrading, please check the Compose-Kotlin compatibility check mentioned in the developer docs
I have upgraded to Kolin : 1.6.20
and used kotlinCompilerExtensionVersion = "1.2.0-alpha08"
. This is an older Kotlin version, you can try the latest one.
Upvotes: 0
Reputation: 1530
This issue arises when you use both Jetpack Compose & kotlin synthetic bindings on the same project.
Removing the kotlin-android-extensions
(used for synthetic binding) plugin will resolve the issue.
Also, synthetic binding is now deprecated you should migrate the code to view binding.
https://developer.android.com/topic/libraries/view-binding/migration
But this was not possible for me at this moment which will require at least 5-6 days for me to do so as I have around 50-60 files using this. So I have to choose the other way around for this case,
composeOptions {
kotlinCompilerExtensionVersion "1.1.0-beta03"
}
I also have to downgrade the Kotlin version for this.
ext.kotlin_version = "1.5.31"
ext.compose_version = '1.1.1'
Upvotes: 3
Reputation: 683
Use below versions to fix the problem composeOptions { kotlinCompilerExtensionVersion '1.1.0-beta03' kotlinCompilerVersion '1.5.31' }
Upvotes: -1
Reputation: 391
I encountered the exact same issue on two different projects when updating the Compose & Kotlin versions.
Removing the kotlin-android-extensions
plugin resolved the issue on both projects for me. This means you can no longer use Kotlin synthetics for view binding.
Upvotes: 37
Reputation: 109
I've seen a few other reports (and myself) seeing the same thing. One temporary workaround is to use new compose with an older compose compiler that doesn't force you to upgrade kotlin since you only need the new compose functionality. Add something like this in your build.gradle with a similar compose version that supports your kotlin version (https://developer.android.com/jetpack/androidx/releases/compose-kotlin)
composeOptions {
kotlinCompilerExtensionVersion = '1.1.0-beta03'
}
Upvotes: 10