Execution failed for task ':XXXX:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
compileSdkVersion was upgraded to 31. The above problems occurred during compilation.
The code was good, but suddenly it could not run
. I checked some information, but could not solve the problem.
Finally, I used this method to solve it:
File->Project Structure, select the SDK Location option,
click Gradle Settings
to pop up Gradle. Window
Specify the following JDK in the Gradle JDK drop-down list box: