After upgrading to `lifecycle-viewmodel:2.5.0-alph...
# compose
j
After upgrading to
lifecycle-viewmodel:2.5.0-alpha01
I’m getting compile errors on classes that inherit from `ViewModelProvider.Factory`:
Inheritance from an interface with ‘@JvmDefault’ members is only allowed with -Xjvm-default option
I’ve tried fiddling all
-Xjvm-default=xxxxx
options but the error does not go away. Anyone had the same trouble?
c
Oooh. I Just got this too after updating. Any luck yet @julioromano?
nope 1
The only additional info I could find is here https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-default/ where there are more option on that flag, but I tried setting them all with no luck. 🤷
think I figured it out. In the module with the problematic code... add
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs += "-Xjvm-default=enable"
    }
}
j
Weird, I tried that too and it kept failing. In the end I reverted to 2.4.0 🤷
c
I initially put it in my root build.gradle and it didn't work. If you put it in your root you have to surround it with subProjects
Also, be sure to have
-Xjvm-default=enable
NOT
-Xjvm-default
(which I know you said you tried. just highlighting for others in the future)