Android Studio Flamingo – kaptGoogleDebugKotlin 错误

huangapple go评论69阅读模式
英文:

Android Studio Flamingo - kaptGoogleDebugKotlin error

问题

我已下载了最新的Android Studio Flamingo(2022.2.1 补丁 2),但在构建我的项目时,出现了以下问题:

执行任务':app:kaptGoogleDebugKotlin'失败。

在执行org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction时发生故障
java.lang.reflect.InvocationTargetException(没有错误消息)

在之前版本的Flamingo中,我没有遇到这个问题。出了什么问题?

英文:

I have downloaded latest Android Studio Flamingo (2022.2.1 patch 2) but during the build of my project, I got the following:

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

In the previous version of Flamingo, I did not have this problem. What is wrong?

答案1

得分: 1

After move to Android Studio: Flamingo, remember these imp few thing

  1. Install/Update JDK 17 in your system and set as JAVA_HOME

example-> C:\jdk17\openjdk-17.0.6

  1. set target JDK version 17

example:

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}

  1. If you use DI framework Hilt or Dagger2 dependency then update with latest version

Example:

// Dagger DI
implementation 'com.google.dagger:dagger:2.47'
kapt 'com.google.dagger:dagger-compiler:2.47'

  1. If any other dependency or lib give such error while building just update with latest version

  2. Please note Kotlin version should be 1.8.## and Gradle should be 8.0

Above 5 points will help you to resolve Flamingo and above version of Android studio issue.

英文:

After move to Android Studio: Flamingo, remember these imp few thing

  1. Install/Update JDK 17 in your system and set as JAVA_HOME

example-> C:\jdk17\openjdk-17.0.6

  1. set target JDK version 17

example:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_17
    targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
    jvmTarget = '17'
}
  1. If you use DI framework Hilt or Dagger2 dependency then update with latest version

Example:

// Dagger DI
implementation 'com.google.dagger:dagger:2.47'
kapt 'com.google.dagger:dagger-compiler:2.47'
  1. If any other dependency or lib give such error while building just update with latest version

  2. Please note Kotlin version should be 1.8.## and Gradle should be 8.0

Above 5 points will help you to resolve Flamingo and above version of Android studio issue.

答案2

得分: 0

我已将JDK版本更改为最新的Amazon Corretto JDK,问题已解决。

英文:

I have changed JDK version to the latest Amazon Corretto JDK and the problem went away.

huangapple
  • 本文由 发表于 2023年6月25日 18:49:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76550030.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定