gpt4 book ai didi

android - 任务 ':app:kaptDebugKotlin' 执行失败。 > 执行 org.jetbrains.kotlin.gradle.internal.KaptExecution 时发生故障

转载 作者:行者123 更新时间:2023-12-05 01:24:49 24 4
gpt4 key购买 nike

在 Android Studio 中构建我的项目时,我收到了这个信息不多的错误。我已经尝试了 stackoverflow 中的所有方法,但没有任何效果。

任务“:app:kaptDebugKotlin”执行失败。

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecutionjava.lang.reflect.InvocationTargetException (no error message)

我的应用程序等级:

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'




}



android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {

configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
}

applicationId "com.nenad.favrecipes"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true

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'
}

android {
buildFeatures {
dataBinding true
}

}


dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" //1.5.21
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'


implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'

implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"

// RxJava
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'

implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"

implementation "com.squareup.okhttp3:okhttp:4.9.1"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.2.1"

implementation 'androidx.multidex:multidex:2.0.1'

implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'

//shimmering RV
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.todkars:shimmer-recyclerview:0.4.1'

implementation 'com.google.code.gson:gson:2.8.7'

implementation 'com.google.dagger:hilt-android:2.40.5'
kapt 'com.google.dagger:hilt-compiler:2.40.5'

implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

// DataStore
implementation "androidx.datastore:datastore-preferences:1.0.0"
implementation "androidx.datastore:datastore:1.0.0"

implementation("androidx.fragment:fragment-ktx:1.3.0")

def room_version = '2.3.0'
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
}
kapt {
correctErrorTypes true
}
}

我的项目gradle:

buildscript {
ext.kotlin_version = "1.3.72"
repositories {
google()
jcenter()
mavenCentral()

}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3' //4.1.3
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40.5'


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

id "org.jetbrains.kotlin.android" version "1.4.20" apply false
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}

}

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

最佳答案

更改Android Studio的JDK版本试试转到文件-> 项目结构-> SDK 位置-> 单击 Gradle 设置

a busy cat

关于android - 任务 ':app:kaptDebugKotlin' 执行失败。 > 执行 org.jetbrains.kotlin.gradle.internal.KaptExecution 时发生故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71135167/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com