Hi, has anyone encountered this issue with Kotlin ...
# android
s
Hi, has anyone encountered this issue with Kotlin 1.7.0 and Hilt?
error: [Hilt]
Unsupported metadata version. Check that your Kotlin version is >= 1.0: java.lang.IllegalStateException: Unsupported metadata version. Check that your Kotlin version is >= 1.0
How can I solve this? using
Copy code
implementation 'com.google.dagger:hilt-android:2.42'
kapt 'com.google.dagger:hilt-android-compiler:2.42'
kapt 'androidx.hilt:hilt-compiler:1.0.0'
classpath('com.google.dagger:hilt-android-gradle-plugin:2.40.1')
j
Yes, I've seen this. It looks like your
hilt-android-gradle-plugin
is an old version. First thing I'd try is upgrading that from
2.40.1
to
2.42
. If that doesn't resolve the issue, I'd try this workaround:
Copy code
dependencies {
  // Not a processor, but forces Dagger to use newer metadata lib
  kapt "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.4.2"
}
👍 1
s
Thanks Jim it worked updating
hilt-android-gradle-plugin
to 2.42
strange thing that AS didn't suggest a new version
where can we check the latest version of
hilt-android-gradle-plugin
?
j
s
thanks @Joffrey. was searching at Google's Maven repo
j
@Sergio C. In general, I think/presume
hilt-android
,
hilt-android-compiler
, and
hilt-android-gradle-plugin
are all released at the same time, and so their version numbers should always match.
👍 2
s
@jim Thanks for the tip. Won't forget that next time.