Leandro Marques
Leandro Marques

Reputation: 31

Error Execution failed for task ':app:kaptDebugKotlin'

I'm trying to build my android project and it's giving me this error: 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)

This is Gradle dependencies

    plugins {
        id 'com.android.application'
        id 'org.jetbrains.kotlin.android'
        id 'kotlin-kapt'
    }
    
    android {
        namespace 'com.newsapi.mvvm'
        compileSdk 33
    defaultConfig {
        applicationId "com.newsapi.mvvm"
        minSdk 26
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false`your text`
            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
    }

    dataBinding {
        enabled = true
    }
}

dependencies {

    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    implementation 'androidx.core:core-ktx:1.10.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
    testImplementation 'junit:junit:4.13.2'
    //noinspection GradleCompatible
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.core:core-ktx:1.10.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.google.android.material:material:1.8.0'

    implementation 'com.squareup.retrofit2:retrofit:2.6.1'
    implementation 'com.squareup.retrofit2:retrofit-converters:2.6.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'

    implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0'

    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'androidx.annotation:annotation:1.6.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    //noinspection LifecycleAnnotationProcessorWithJava8
    annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.6.1'

    kapt "com.google.dagger:dagger-compiler:2.41"
    implementation 'com.google.dagger:dagger:2.41'

    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-runtime:2.6.1'

    implementation 'android.arch.persistence.room:runtime:1.1.1'
    kapt 'android.arch.persistence.room:compiler:1.1.1'
    kapt "androidx.room:room-compiler:2.6.0-alpha01"

    implementation 'org.jetbrains.anko:anko-common:0.9'

    debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

I tried to clean the project and rebuild and change the kotlin version to a lower one

Upvotes: 3

Views: 4339

Answers (1)

Vikash Kumar Tiwari
Vikash Kumar Tiwari

Reputation: 815

If you are using dagger dependencies(not android specific) you can upgrade your dagger2 dependency version to 2.48.1 your problem shall be solved.

implementation("com.google.dagger:dagger:2.48.1")
kapt("com.google.dagger:dagger-compiler:2.48.1")

Above two dependencies are sufficient if you do are not using android-dagger

Upvotes: 2

Related Questions