执行 org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction?java.lang.reflect.Invocation 时发生故障?

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction?java.lang.reflect.Invocation?

当我在真实设备中 运行 android 应用程序时,出现以下 gradle 错误

Execution failed for task ':common:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
   > java.lang.reflect.InvocationTargetException (no error message)

低于我的 app.gradle

    plugins {
    id 'com.android.application'
    id 'kotlin-android'
}
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'kotlin-kapt'

apply from: '../commons.gradle'

android {
    compileSdkVersion 30
    buildFeatures {

        dataBinding = true

        // for view binding:
        // viewBinding = true
    }

    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.androidcodingchallenge"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables{
            useSupportLibrary = true
        }

        multiDexEnabled true
    }

    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 = JavaVersion.VERSION_1_8.toString()
    }
}

dependencies {
    implementation project(':data')
    implementation project(':domain')
    implementation project(':presentation')
    implementation project(':remote')
    implementation project(':cache')
    implementation project(':common')
    implementation project(':device')

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation "com.google.android.material:material:$material_version"

    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    implementation 'androidx.cardview:cardview:1.0.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    //navigation component
//    implementation "androidx.navigation:navigation-fragment-ktx:2.3.2"
//    implementation "androidx.navigation:navigation-ui-ktx:2.3.2"

    // UI
    implementation "com.github.bumptech.glide:glide:$glide_version"
    kapt "com.github.bumptech.glide:compiler:$glide_version"

    // Ktx
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.0"
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0'
    implementation "androidx.fragment:fragment-ktx:1.3.0"

    // Navigation
    implementation "android.arch.navigation:navigation-fragment-ktx:$version_navigation"
    implementation "android.arch.navigation:navigation-ui-ktx:$version_navigation"

    //viewpager2
    implementation "androidx.viewpager2:viewpager2:1.0.0"

    implementation 'com.thoughtbot:expandablerecyclerview:1.3'
    implementation 'com.thoughtbot:expandablecheckrecyclerview:1.4'

    //indicator
    implementation 'me.relex:circleindicator:2.1.4'
    //lottie
    implementation "com.airbnb.android:lottie:3.4.1"
    //datastore
    implementation "androidx.datastore:datastore-preferences:1.0.0-alpha06"

    implementation 'androidx.hilt:hilt-navigation-fragment:1.0.0-alpha03'

    //LeakCanary
    debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'

    //multidex
    implementation 'com.android.support:multidex:1.0.3'

}

低于commons.gradle

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'

androidExtensions {
    experimental = true
}

android {
//    compileSdkVersion Versions.compileSdkVersion
//    buildToolsVersion Versions.buildTool
//    defaultConfig {
//        minSdkVersion Versions.minSdk
//        targetSdkVersion Versions.targetSdk
//        versionCode Releases.versionCode
//        versionName Releases.versionName
//        vectorDrawables.useSupportLibrary = true
//    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    kapt {
        javacOptions {
            // Increase the max count of errors from annotation processors.
            // Default is 100.
            option("-Xmaxerrs", 500)
        }
        // Configure kapt to correct error types for Hilt
        correctErrorTypes true
    }

    buildFeatures{
        dataBinding = true
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    lintOptions {
        abortOnError false
    }

    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}

dependencies {
    //Loads packaged libraries in the libs folder
    implementation fileTree(dir: 'libs', include: ['*.jar'])

//    implementation KotlinLibraries.kotlin
//    implementation AndroidLibraries.coreKtx
//
//    implementation Libraries.hilt
//    implementation Libraries.hiltJetpack
//    kapt Libraries.hiltCompiler
//    kapt Libraries.hiltJetpackCompiler
//
//    // For instrumentation tests
//    androidTestImplementation Libraries.hiltAndroidTest
//    kaptAndroidTest Libraries.hiltAndroidTestCompiler
//
//    // For local unit tests
//    testImplementation Libraries.hiltAndroidUnitTest
//    kaptTest Libraries.hiltAndroidUnitTestCompiler
//
//    implementation TestLibraries.androidTestRunner
//    implementation TestLibraries.junit
//    implementation TestLibraries.espresso
//    implementation TestLibraries.espressoContrib

    // Concurrency
    implementation "io.reactivex.rxjava2:rxkotlin:$rxkotlin_version"
    implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"


    //Hilt
    implementation "com.google.dagger:hilt-android:$hilt_version"
    kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
    implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_androidx_version"
    kapt "androidx.hilt:hilt-compiler:$hilt_androidx_version"

    // Utils
    implementation "com.jakewharton.threetenabp:threetenabp:$threetenabp_version"


}

低于 build.gradle 文件

buildscript {
    ext{
        kotlin_version = "1.4.20"
        version_navigation = "2.3.5"
        hilt_version = '2.31.2-alpha'

        version_navigation = "2.3.5"
        version_lifecycle_extensions = "2.2.0"
        lifecycle_version = "2.2.0"
        hilt_androidx_version = "1.0.0-alpha03"

        material_version = "1.3.0"

        coroutines_version = "1.4.1"

        junit_version = "4.13"

        retrofit_version = "2.9.0"
        okHttp_version = "4.9.0"
        moshi_converter_version = '2.9.0'
        moshi_version = '1.11.0'

        mockwebserver_version = "4.9.0"
        robolectric_version = "4.4"
        mockito_version = "3.5.15"
        google_truth_version = "1.0"
        coroutines_test = "1.3.1"

        room_version = "2.3.0"

        threetenabp_version = "1.2.4"
        leakcanary_version = "2.4"
        timber_version = "4.7.1"

        glide_version = "4.11.0"
        androidsvg_version = "1.4"

        rxkotlin_version = "2.4.0"
        rxandroid_version = "2.1.1"

        google_services_version = "4.3.8"
    }

    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$version_navigation"

        classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"

        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        classpath "com.google.gms:google-services:$google_services_version"
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'

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

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

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

我尝试过的无效缓存重启

关注这个 issue tracker 我已经尝试了所有建议的答案 在那里它没有解决我的问题,除此之外, 我在 运行 gradlew clean in android studio 中出现以下错误 FAILURE: Build completed with 2 failures.

1: 任务因异常而失败。

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction java.lang.reflect.InvocationTargetException (no error message)

2: 任务因异常而失败。

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction java.lang.reflect.InvocationTargetException (no error message)

请注意,我使用的是 Android Studio Arctic Fox

我想知道我到底哪里出错了

我通过将当前的 kotlin 版本更新到最新版本并将 moshi 版本更新到 1.12.0 来解决我的问题