Configure project -6ren">
gpt4 book ai didi

android - 更新到 Gradle 5.1.1 给出 "The ProjectLayout.fileProperty() method has been deprecated"

转载 作者:行者123 更新时间:2023-11-29 18:36:20 26 4
gpt4 key购买 nike

我正在开发一个以前使用 Gradle 4.6 的项目,它运行良好。我刚刚更新到 Gradle 5.1.1,我现在收到以下警告(虽然不确定它们是警告还是错误):

> Configure project :app
Warning: Please apply google-services plugin at the bottom of the build file.
The ProjectLayout.fileProperty() method has been deprecated. This is scheduled to be removed in Gradle 6.0. Please use the ObjectFactory.fileProperty() method instead.
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

FAILURE: Build failed with an exception.

* What went wrong:
Failed to notify build listener.
> org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

CONFIGURE FAILED in 0s
Cause: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;

我在整个项目中搜索了 ProjectLayout.fileProperty,但没有找到类似的字符串。 fileProperty 在哪里使用然后导致编译器提示?我如何修复这些弃用警告而不是抑制它们?我的代码有一部分需要更改吗?或者编译器指向的用法是否发生在我添加的库之一中?

最佳答案

这些是警告,而不是错误,可以来自您自己的构建脚本,也可以来自插件。这些警告,正如它们所表明的那样,在移动到下一个 Gradle 主要版本时可能会变成错误。

  • 如果警告源在您的构建脚本中,您应该尽快让它们消失。这样升级到下一个 Gradle 主要版本将不是问题。
  • 当来自插件时,如果您能识别出正确的插件,请升级到更新的版本,如果警告仍然存在,请提交问题。这样您就有更好的机会让插件继续与下一个 Gradle 主要版本一起工作。

关于android - 更新到 Gradle 5.1.1 给出 "The ProjectLayout.fileProperty() method has been deprecated",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54177697/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com