I
I
Ibrahim Tubaev2022-03-08 15:58:23
Java
Ibrahim Tubaev, 2022-03-08 15:58:23

How to fix ':app:kaptDebugKotlin' application compilation error?

When compiling the application, it gives an 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)

build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.4.32'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Second build.gradle file:
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'


android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "io.exoji2e.sugartop"
        minSdkVersion 24
        //noinspection ExpiredTargetSdkVersion
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        android.defaultConfig.vectorDrawables.useSupportLibrary = true
        vectorDrawables.useSupportLibrary = true
        kapt {
            correctErrorTypes = true
            arguments {
                arg("room.schemaLocation", "$projectDir/schemas".toString())
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    def room_version = "1.1.1-rc1"
    implementation "android.arch.persistence.room:runtime:" + room_version
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.takisoft.fix:preference-v7:28.0.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    kapt "android.arch.persistence.room:compiler:" + room_version
    kapt "androidx.room:room-compiler:2.3.0"

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'

    // GraphLibs
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

gradle.properties file:
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true


How to fix this error? I searched all the forums, the answers did not fit.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question