android - Gradle 失败 - null VariantManager

标签 android gradle kotlin cordova-android

我的项目不再构建 - 这是我尝试在 Android Studio 中构建时遇到的错误:

null cannot be cast to non-null type com.android.build.gradle.internal.VariantManager 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.

我清除了 Gradle 的依赖项缓存,并且重新启动了多次,因此我相信我已经排除了上述前 2 个可能的原因。我的项目也已停止为团队中的其他人构建,因此这不太可能是本地缓存问题。

第三个可能的原因很有趣。在不对我的代码/配置进行任何更改的情况下,这会停止工作(并且现在在我们已成功构建的以前版本的代码中失败),但我们确实有可以更新的第 3 方 cordova 插件,并且这些插件可以使用 gradle 插件。

什么可能导致此构建失败,或者如何调试它?

最佳答案

发现问题 - kotlin-android 插件有一个补丁版本更新,破坏了我的构建。为了找到它,我一次删除了项目中的 gradle 插件,直到它再次开始构建;我希望这对其他人有帮助!

关于android - Gradle 失败 - null VariantManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51751553/

相关文章:

android - 添加 TextViews 并更新 ViewGroup 以显示 Textviews

android - 在UI测试期间启动后,应用程序关闭

android - 如何在 Kotlin 中创建异步 post 请求?

kotlin - 为什么在尝试为已检查的泛型参数返回值时会出现类型不匹配?

android - 图像未从 ListView 上的 URL 加载

android - Device-File-Explorer在Android-Studio中的作用是什么

Java、Gradle、CI 和指定内存使用限制

android - 找不到参数的方法 kotlin() [gradle-plugin, 1.3.20]

gradle - Apache Jena 3.11.0的Gradle

kotlin - 在 Kotlin 中,是否可以在不破坏调用者的情况下用非暂停版本替换暂停乐趣?