在 android studio 中执行 org.jetbrains.kotlin.gradle.internal.KaptExecution 安装 Glide 时发生故障

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution installing Glide in android studio

我正在阅读有关如何在我的应用程序上安装新 glide 的文档,现在非常困难,因为他们更新了新的 api 和文档,与之前和之后的说明不同,但为什么我'我收到此错误:

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution

我已经尝试了很多方法来调试它。但是我的问题还没有解决。

这是我的 build.grade:app:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.1"

    defaultConfig {
        applicationId "com.example.app1"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.1'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.material:material:1.2.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation("com.squareup.okhttp3:okhttp:4.8.1")

    kapt 'com.github.bumptech.glide:compiler:4.11.0'
}

你好像忘记添加依赖了

试试这个

dependencies {
  implementation 'com.github.bumptech.glide:glide:4.11.0'
  kapt 'com.github.bumptech.glide:compiler:4.11.0'
}

同时在你的项目级别build.gradle文件中添加这个:

repositories {
      google()
      jcenter()
    }