我的项目不再构建 - 这是我尝试在 Android Studio 中构建时遇到的错误:
null cannot be cast to non-null type com.android.build.gradle.internal.VariantManager Possible causes for this unexpected error include:
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
- 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.
我清除了 Gradle 的依赖项缓存,并且重新启动了多次,因此我相信我已经排除了上述前 2 个可能的原因。我的项目也已停止为团队中的其他人构建,因此这不太可能是本地缓存问题。
第三个可能的原因很有趣。在不对我的代码/配置进行任何更改的情况下,这会停止工作(并且现在在我们已成功构建的以前版本的代码中失败),但我们确实有可以更新的第 3 方 cordova 插件,并且这些插件可以使用 gradle 插件。
什么可能导致此构建失败,或者如何调试它?
最佳答案
发现问题 - kotlin-android 插件有一个补丁版本更新,破坏了我的构建。为了找到它,我一次删除了项目中的 gradle 插件,直到它再次开始构建;我希望这对其他人有帮助!
关于android - Gradle 失败 - null VariantManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51751553/