kotlin - 无法加载类 'kotlin.coroutines.Continuation'

标签 kotlin gradle

这个错误在我的Kotlin项目中不时发生。我尝试了几种Kotlin版本(1.3.41、1.3.60、1.3.72),但这似乎适用于任何版本和各种项目。一旦开始发生,我将无法构建任何项目。

完整的错误消息:

Unable to load class 'kotlin.coroutines.Continuation'. Possible causes for this unexpected error include: Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.



我尝试了所有建议,但都无济于事。当我点击
它说:“重新下载依赖项并同步项目(需要网络)”
project is not a Gradle-bsed project

单击“停止Gradle构建过程(需要重新启动)”将重新启动Intellij,但无济于事。

关闭Intellij并杀死Java进程也无济于事。

最佳答案

虽然错误弹出窗口中的所有链接建议均无效,但手动运行“干净” gradle任务确实可以解决问题!

./gradlew clean

该错误仍然会偶尔出现一次,但是可以通过运行gradle clean来可靠地修复。

关于kotlin - 无法加载类 'kotlin.coroutines.Continuation',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62134733/

相关文章:

java - Ant WsImport 在 gradle 中编译生成的 java 文件时抛出错误

hibernate - 运行导出器#2:hbm2ddl时发生异常(生成数据库架构)

android - 找不到错误 :resource style/TextAppearance. Compat.Notification.Info(又名 {packageId}.test :style/TextAppearance. Compat.Notification.Info)

android - 如何使用 Retrofit 发送 post 请求?

android - Markdown 编辑器和预览在 Android Studio 中不起作用?

android - 如何过滤 gradle 中的子模块以应用适当的插件?

android - gradle 执行过程错误流

java - Kotlin 术语 "mutable"错了吗?

android - 在Kotlin中使用JSONObject总是会引发错误

kotlin - 如何在 Kotlin 中强制执行空的非空字符串?