is `Compose` ready to work with `Kotlin 1.4.20` ? ...
# compose
m
is
Compose
ready to work with
Kotlin 1.4.20
? I am asking it because I have a project working fine with
Kotlin 1.4.10
, but when I try to update it to
Kotlin 1.4.20
the compilation fails:
Copy code
The root cause java.lang.NoSuchMethodError was thrown at: 
e: java.lang.IllegalStateException: Backend Internal error: Exception during file facade code generation
File being compiled: file:///Users/magnumrocha/personal/my_app/app/src/main/java/com/myapp/Commons.kt
androidx.compose.compiler.plugins.kotlin.lower.ClassStabilityFieldSerializationPlugin.afterClass(ClassStabilityFieldSerializationPlugin.kt:57)
the `Commons.kt`:
Copy code
sealed class MenuAction(@StringRes val label: Int, val icon: VectorAsset) {
    object History : MenuAction(R.string.history_menu, Icons.Outlined.List)
    object About : MenuAction(R.string.about_menu, <http://Icons.Outlined.Info|Icons.Outlined.Info>)
}
f
AFAIK compose alpha08 will be ready, but alpha07 is not
m
oh, ok that's it so....
a
not alpha release, but they pushed it in snapshot for those who really need it
m
this is happening to me yet
but, I can use
kotlin 1.4.10
with
compose 1.0.0-alpha08
j
@David Edwards That error is an indication that you are not actually using Compose
1.0.0-alpha08
, as that error can only occurs if you are using Kotlin 1.4.20 with an older version of Compose. @magnumrocha Kotlin
1.4.10
does NOT work with Compose
1.0.0-alpha08
so if you are using Kotlin
1.4.10
then you are NOT using Compose
1.0.0-alpha08
and vice versa.
Be sure to check both your
kotlinCompilerVersion
and your
kotlinCompilerExtensionVersion
and to kill all gradle daemons and kill your gradle cache before performing your build.
m
@jim I've updated only the compose libraries, not the compose compiler (still on
1.0.0-alpha07
) and everything works well
Copy code
composeOptions {
    kotlinCompilerVersion "1.4.10"
    kotlinCompilerExtensionVersion '1.0.0-alpha07'
}

dependencies {

    ...

    // Jetpack Compose libraries
    def compose_version = "1.0.0-alpha08"
    implementation "androidx.compose.ui:ui:$compose_version"
    // Tooling support (Previews, etc.)
    implementation 'androidx.ui:ui-tooling:1.0.0-alpha07'
    // Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
    implementation "androidx.compose.foundation:foundation:$compose_version"
    // Material Design
    implementation "androidx.compose.material:material:$compose_version"
    // Material design icons
    implementation "androidx.compose.material:material-icons-core:$compose_version"
    implementation "androidx.compose.material:material-icons-extended:$compose_version"
    // Integration with observables
    implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
    // Navigation for Compose
    implementation "androidx.navigation:navigation-compose:1.0.0-alpha03"
}
d
@jim • Android Studio cache invalidated • Gradle processes stopped • Gradle cache deleted Problem resolved. Thanks for the feedback.
m
@David Edwards do you have
kotlin 1.4.20
with
compose 1.0.0-alpha08
working?
d
Yes. I have never needed to fully delete my cache
.gradle/caches
before, but that seemed to do the trick.
m
ok, I'm going to try it now...
now it working 🦜 , but in my case, only the Android Studio cache invalidated has solved the problem 💪 , anyway thank you guys @David Edwards @jim
🎉 1