Error: 'Unable to load class AndroidComponentsExtension' when building app with Hilt

Viewed 25

Trying to add Hilt to my project but sync fails. My app gradle contains these lines:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'

the last one triggers the error "Unable to load com.android.build.api.extension.AndroidComponentsExtension". Full trace here: https://pastebin.com/dZFg7yyX

Kotlin version is: '1.6.10' Here the dependencies in the root gradle script:

dependencies {
    classpath 'com.android.tools.build:gradle:7.2.1'
    classpath 'io.realm:realm-gradle-plugin:7.0.8'
    classpath 'com.google.gms:google-services:4.3.8'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.huawei.agconnect:agcp:1.7.0.300'
    classpath "com.google.dagger:hilt-android-gradle-plugin:2.35"
}

and in my app gradle I have:

implementation 'com.google.dagger:hilt-android:2.35'
kapt 'com.google.dagger:hilt-android-compiler:2.35'

Any hint?

0 Answers
Related