Android Studio北极狐金丝雀8开始警告JCenter is at end of life
但我不能只删除jcenter()
声明,因为它承载了很多 android 工件,它会导致 Could not resolve all artifacts
错误。解决此警告的正确方法是什么?
最佳答案
有一个描述问题的文档部分:JCenter deprecation and end of service .您可以通过展开检查说明 (Ctrl+F1
) 找到该链接。该文档指出:
JFrog, the company that maintains the JCenter artifact repository used by many Android projects, recently announced the deprecation and upcoming retirement of JCenter. According to the announcement, JCenter will allow downloads of existing artifacts until February 1, 2022.
Developers who publish artifacts on JCenter should start migrating their packages to a new host, such as Maven Central.
In the near future, we will provide additional information about migrating Android projects away from JCenter on this page.
扩展的检查说明(以及上面的文档)建议替换
jcenter()
通过 mavenCentral()
.实际上,JCenter 是 Maven Central 的超集,但是在您的项目使用的所有 JCenter 工件都被移到 Maven Central 之前,这样的替换不会解决问题。我认为最佳解决方案是等到您正在使用的库从
jcenter()
移出。并尝试将其替换为 mavenCentral()
.如果仍然缺少某些工件,请查看文档,可能它们已移至另一个存储库,您应该将其添加到 repositories
也列出来。repositories {
google()
// jcenter() // <- removed
mavenCentral() // <- added
}
如果您是库作者,您应该迁移到另一个 repo,可能是 Maven Central。请注意,根据 JCenter deprecation announcement新的提交只允许在 2021 年 3 月 31 日之前提交。一些相关资源:
关于android - "JCenter is at end of life"android lint 警告,替换是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66400264/