How can I fix this error Android: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:

How can I fix this error Android: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:

我在编译项目时遇到了这个错误。我在网上看不到任何有用的解决方案

 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"


implementation "androidx.room:room-runtime:2.2.6"
implementation "androidx.room:room-ktx:2.2.6"
kapt "androidx.room:room-compiler:2.2.6"



//Anyone with a better approach to solve this

org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: 
 Couldn't transform method node:
 emit (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // 
 @Lorg/jetbrains/annotations/NotNull;() 1

这似乎是 kotlin-codegen 问题..尝试更新您的 kotlin 和代码生成器。

implementation "com.squareup.moshi:moshi-kotlin:1.11.0"
implementation "com.squareup.moshi:moshi-adapters:1.11.0"
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.11.0"

也将您的 kotlin 和您的房间库更新到最新版本

 implementation "androidx.room:room-runtime:2.4.2"
 implementation "androidx.room:room-ktx:2.4.2"
 kapt "androidx.room:room-compiler:2.4.2"

并重新编译您的代码