Repository navigation
❗ Kotlin 2.1.20 + Hilt 2.56.1: Unable to read Kotlin metadata due to unsupported metadata kind: null on CoroutineWorker #4693
Description
Activity
It seems this issue is coming from androidx's Hilt worker extension. Can you use
--stacktracein Gradle command line to confirm this? What version ofandroidx.hilt.hilt-compilerare you using?If you explicitly depend on
androidx.room:room-compiler-processing:2.7.0does it fix the issue for you?Reacted by Matej Hlatký, David Khol, Adebayo Ibiyemi Osipitan and moraylThank you, @danysantiago, adding
kapt("androidx.room:room-compiler-processing:2.7.0")to the dependencies fixed the compilation issue!Will check if it runs fine.
Reacted by Nosco and Adebayo Ibiyemi Osipitan@danysantiago How can I confirm that? What exactly should I look for in the stacktrace?
I'm using version
1.2.0ofandroidx.hilt:hilt-compiler.I also tried the workaround suggested by @LouisCAD, but no luck on my end. (I'm using KSP for Room, so I replaced
kaptwithksp.)For now, I’ve temporarily resolved the compilation issue by downgrading Kotlin to
2.1.10and KSP to2.1.10-1.0.30.Same issue here.
I use KSP for room and KAPT for Hilt. Upgrading to Kotlin 2.1.20 breaks the build. I need to usekapt.use.k2=falseas a workaroundReacted by Javad Jafari, bolebolo, Ali Nasrabadi and Matej HlatkýAlso, I tried setting
ksp.useKSP2=false, but the issue remains.I’ll try the workaround suggested by @ffgiraldez next and report back.
@ffgiraldez's workaround worked for me too.
Hi, I had the same issue as you. I was using:
kapt(libs.hilt.compiler) // for Hilt ksp(libs.room.compiler.ksp) // for RoomVersions:
Room: 2.7.2 Kotlin: 2.1.21 KSP: 2.1.21-2.0.1 WorkManager: 2.10.2 Hilt Work: 1.2.0Everything started working properly once I replaced:
kapt(libs.hilt.compiler)
with
ksp(libs.hilt.compiler)It took me a while to figure out the issue, but it’s finally resolved.
If you must use kapt, the solution provided by @ffgiraldez works as well.
Hope this helps someone in the future!
Reacted by Sergey ChuvashevWe fixed this issue by adding
kapt(androidx.room:room-compiler-processing:2.7.2)to our scripts.AFAIK,
androidx.hilt:hilt-worktrips up because theandroidx.hilt:hilt-compilerprocessor depends on theroom-compiler-processing:2.6.0at the moment:
@danysantiago, would you be so kind as to ping someone to bump the version in
hilt-compiler?The latest RC version of
androidx.hiltdoes not seem to contain it.Reacted by vignesh-discovery and Ali Nasrabadihi i am very new in android development. currently facing gradle issue when increasing kotlin version from 1.9.0 to 2.1.0 so for this using :-
- AGP - 8.5.0
- kotlin - 2.1.0
- hilt - 2.55
- room - 2.6.1
- in wrapper - 8.9
now getting error-
Execution failed for task ':app:kaptDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
can anybody help on it ?
- added a commit that references this issue
on Aug 30, 2026
After updating to Kotlin 2.1.20 and Hilt 2.56.1, I'm getting the following error at compile time:
error: Unable to read Kotlin metadata due to unsupported metadata kind: null. public final class XStatusWorker extends androidx.work.CoroutineWorker {This happens in a class that uses @HiltWorker with @AssistedInject constructor and also has @Inject lateinit var fields.
This setup was working fine with Kotlin 2.0.x and Hilt 2.51+, and it broke only after moving to Kotlin 2.1.20.
Repro info:
Kotlin: 2.1.20
AGP: 8.9.1
Hilt: 2.56.1
By the way Im using Kapt not KSP