【发布时间】:2021-08-09 16:26:51
【问题描述】:
我正在尝试为 Android Studio 关注 this YouTube tutorial,但是当我创建我的项目时,我收到以下错误:
class org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager cannot be cast to class org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager (org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @1824eb4b; org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @61548dd0)
class org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager cannot be cast to class org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager (org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @1824eb4b; org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @61548dd0)
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.
- AS:2020.3.1(从 4.3 重命名的版本)
- 操作系统:Linux (Fedora)
- Gradle:6.8
起初,它似乎与this issue 非常相似,但我的错误的前两行不同,可能是因为我的AS版本更新了很多。
我很肯定这与网络超时无关。
我尝试了类似问题的解决方案,从~/.gradle/wrapper/dists 中删除我的Gradle 包装器,然后重新同步项目。虽然这消除了错误,但它无法使用初始项目文件生成 app 目录,我只剩下配置文件:
因此,我要么正在寻找针对 dependency cache 错误的不同解决方案,要么正在寻找缺失项目文件的修复方法。
此问题似乎特定于 AS 2020.3.1 中使用 Kotlin 的项目。我无法使用 Java 项目或 AS 4.1.2(本教程中使用的版本)进行复制。
更新:删除并重新安装 AS 2020.3.1 并不能解决问题,但将 AS 2020.3.1 替换为 AS 4.1.2 可以。此外,在将 2020.3.1 替换为 4.1.2 并重新安装 2020.3.1 后,该项目随后在 2020.3.1 上运行。这一定是由于 2020.3.1 的配置问题,该问题已通过先前版本的配置设置修复。
【问题讨论】:
标签: android-studio kotlin gradle jetbrains-ide