I want to use hilt in androidMain of kmm project, ...
# multiplatform
h
I want to use hilt in androidMain of kmm project, how to setup in build gradle.kts
Copy code
androidMainImplementation(libs.hiltAndroid)
    androidMainImplementation(libs.hiltNavigationFragment)
    kapt(libs.hiltAndroidXCompiler)
    kapt(libs.hiltCompiler)
with android, it’s ok but with kapt it cannot build for iosMain
d
It won't be able to, Hilt is built for the JVM only. Two suggestions: read the Kotlin Multiplatform introductory documentation, it may clear up any misunderstanding about how KMP works. Secondly, avoid using codegen/annotation driven DI. Experience tells me it's rarely worth the problems it causes.
🙌 1
j
Check out Koin or another library which supports KMP.
🙌 1
h
thanks guys
391 Views