Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported metadata version. Check that your Kotlin version is >= 1.0: java.lang.IllegalStateException

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.

enter image description here

like image 961
Hasan Kucuk Avatar asked Sep 06 '25 03:09

Hasan Kucuk


2 Answers

Dagger/Hilt version 2.43.2 appears to have fixed this issue.

See https://github.com/google/dagger/releases/tag/dagger-2.43.2

like image 185
yincrash Avatar answered Sep 07 '25 23:09

yincrash


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
}
like image 24
Rodrigo Queiroz Avatar answered Sep 07 '25 21:09

Rodrigo Queiroz