I changed my Kotlin version from 1.6.10 to 1.7.0.
from this
 implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10'
upgrated to
 implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.0'
But Hilt throws an error. My Hilt version is 2.42. Is there a way to fix this without downgrading again? It works fine in Kotlin 1.6.10 and Hilt 2.42. But I want to use it by upgrading my kotlin version.

Dagger/Hilt version 2.43.2 appears to have fixed this issue.
See https://github.com/google/dagger/releases/tag/dagger-2.43.2
You can add kapt "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.4.2" and the problem will go away, however if you are using Jetpack Compose then you will have to downgrade your Kotlin version to 1.6.10 as Compose compiler is not compatible with Kotlin 1.7.0 as of yet.
plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
    id 'org.jetbrains.kotlin.jvm' version '1.6.10' apply false
    id 'com.google.dagger.hilt.android' version '2.42' apply false
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With