android – Exception during code generation Jetpack Compose-ThrowExceptions

Exception or error:

I just tried to load an image from my resources with val context = ambient(ContextAmbient) but when I try to run the project I get an error during the generation of the code.

java.lang.IllegalStateException: Backend Internal error: Exception during code generation

fun MovieImage(image: Int) {
    val context = ambient(ContextAmbient)
    Container(modifier = Modifier.None, width = 24.dp, height = 24.dp) {
        DrawImage(image = imageFromResource( context.resources, image))
How to solve:

I ran in to the same problem when upgrading from 0.1.0-dev03 to 0.1.0-dev05.
It was solved by adding composeOptions{ kotlinCompilerExtensionVersion "0.1.0-dev05" } to my build.gradle like this:

android {
    // ... other gradle properties

    buildFeatures {
        compose true
    composeOptions {
        kotlinCompilerExtensionVersion "0.1.0-dev05"

Leave a Reply

Your email address will not be published. Required fields are marked *