Getting error below while using dagger-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
Please note that I already followed some topics from stackoverflow and other documentation Hilt Unsupported metadata version in Kotlin
https://github.com/google/dagger/issues/2379
Using below app gradle configuration
compileSdk 32
defaultConfig {
applicationId "com.test.plantdemo"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
}
Android plugin
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
App level dependency
dependencies {
implementation "androidx.work:work-runtime-ktx:2.5.0"
kapt 'androidx.hilt:hilt-compiler:1.0.0'
implementation 'androidx.hilt:hilt-work:1.0.0'
kapt "com.google.dagger:hilt-android-compiler:2.35.1"
kapt "com.google.dagger:hilt-compiler:2.35.1"
implementation "com.google.dagger:hilt-android:2.35.1"
}
Top level dependency I used
dependencies {
// other plugins...
//classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40'
}
Top level gradle Plugin
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.7.0' apply false
id 'com.google.dagger.hilt.android' version '2.41' apply false
}
Error window shows below error
[Hilt] Processing did not complete.
See error above for details. Execution failed for task ':app:kaptDebugKotlin'. A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction java.lang.reflect.InvocationTargetException (no error message)
step I followed after adding library
Step1: Android application class
@HiltAndroidApp
class PlantApplication: Application() {
}
Step2: Module calss
@Module
@InstallIn(SingletonComponent::class)
object MainModule {
}
Step3: View Model
@HiltViewModel
class PlantListBaseViewModel @Inject constructor(): ViewModel() {
}
Step4: fragment
@AndroidEntryPoint
class PlantListBaseFragment : Fragment() {
}