Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execution failed for task ':app:kspDebugKotlin'. > A failure occurred while executing ..GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction

I have been trying to implement a mobile application which was supposed to use Dagger Hilt, Glide and Kapt. However, when I tried to implement it, I got an error calling for [Hilt] error. To solve the problem, there were suggestions to change the Kapt to annotationProcessor in the dependencies. I figured KSP is what is recommended for use instead of Kapt. But I have been unable to build the projects after changing the dependencies and I am getting the error mentioned.


> Task :app:kspDebugKotlin FAILED
e: [ksp] No providers found in processor classpath.
e: Error occurred in KSP, check log for detail

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:kspDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

What am I doing wrong?

Project level build.gradle,

buildscript {
    ext {
        kotlin_version = '1.9.22'
    }
    dependencies {
        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40.1'
        classpath 'com.google.gms:google-services:4.3.13'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"

        def nav_version = "2.5.0"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
    }
    repositories {
        mavenCentral()
    }
}


// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '8.0.2' apply false
    id 'com.android.library' version '8.0.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
    id 'com.google.devtools.ksp' version "1.9.22-1.0.17" apply false
}

The module level build.gradle is as

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.devtools.ksp'
    id 'androidx.navigation.safeargs.kotlin'
    id 'dagger.hilt.android.plugin'
    id 'kotlin-parcelize'
    id 'com.google.gms.google-services'
}

android {
    namespace 'com.unitytests.virtumarttest'
    compileSdk 33

    defaultConfig {
        applicationId "com.unitytests.virtumarttest"
        minSdk 27
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    buildFeatures{
        viewBinding true
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.core:core-ktx: 1.8.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'


    //apply plugin :"kotlin-kapt"

    //loading button
    implementation 'br.com.simplepass:loading-button-android:2.2.0'

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.13.0'

    //circular image
    implementation 'de.hdodenhof:circleimageview:3.1.0'

    //viewpager2 indicatior
    implementation 'io.github.vejei.viewpagerindicator:viewpagerindicator:1.0.0-alpha.1'

    //stepView
    implementation 'com.shuhart.stepview:stepview:1.5.1'

    //Android Ktx
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'

    //Dagger hilt
    implementation "com.google.dagger:hilt-android:2.38.1"
    ksp "com.google.dagger:hilt-compiler:2.38.1"

    //Firebase
    implementation 'com.google.firebase:firebase-auth:21.1.0'
}

As additional material, the code for project level build.gradle file from the tutorial is similar to one given below.

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-parcelize'
    id 'androidx.navigation.safeargs.kotlin'
    id 'dagger.hilt.android.plugin'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.example.kelineyt"
        minSdk 27
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    buildFeatures {
        viewBinding true
    }

}

dependencies {

    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

    apply plugin :"kotlin-kapt"

    //loading button
    implementation 'br.com.simplepass:loading-button-android:2.2.0'

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.13.0'

    //circular image
    implementation 'de.hdodenhof:circleimageview:3.1.0'

    //viewpager2 indicatior
    implementation 'io.github.vejei.viewpagerindicator:viewpagerindicator:1.0.0-alpha.1'

    //stepView
    implementation 'com.shuhart.stepview:stepview:1.5.1'

    //Android Ktx
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'

    //Dagger hilt
    implementation "com.google.dagger:hilt-android:2.38.1"
    kapt "com.google.dagger:hilt-compiler:2.38.1"

    //Firebase
    implementation 'com.google.firebase:firebase-auth:21.0.6'


}

The build.gradle of module level of it is as

buildscript {
    dependencies {
        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40.1'
        classpath 'com.google.gms:google-services:4.3.13'

        def nav_version = "2.5.0"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
    }
}

plugins {
    id 'com.android.application' version '7.3.0' apply false
    id 'com.android.library' version '7.3.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
like image 994
Isuru Dissanayake Avatar asked Sep 03 '25 17:09

Isuru Dissanayake


2 Answers

I found solution for Glide

// From
implementation("com.github.bumptech.glide:glide:4.14.2")
kapt("com.github.bumptech.glide:compiler:4.14.2")

// To
implementation("com.github.bumptech.glide:glide:4.14.2")
ksp("com.github.bumptech.glide:ksp:4.14.2")
like image 98
georgehardcore Avatar answered Sep 05 '25 06:09

georgehardcore


Turns out that glide ksp compiler should use com.github.bumptech.glide:ksp:$version instead of com.github.bumptech.glide:compiler:$version

like image 42
BR SmartTools Avatar answered Sep 05 '25 07:09

BR SmartTools