"JCenter生命将尽"android lint警告,替换什么? [英] "JCenter is at end of life" android lint warning, what is the replacement?

查看:207
本文介绍了"JCenter生命将尽"android lint警告,替换什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android Studio Arctic Fox Canary 8开始警告 JCenter寿命已尽

Android Studio Arctic Fox Canary 8 started to warn that JCenter is at end of life

但是我不能只删除 jcenter()声明,因为它包含许多android构件,这会导致无法解决所有构件错误.解决此警告的正确方法是什么?

But I cannot just delete jcenter() declarations since it hosts a lot of android artifacts, it would lead to Could not resolve all artifacts error. What is the right way to solve this warning?

推荐答案

有一个文档部分描述了该问题:

There's a documentation section describing the problem: JCenter deprecation and end of service. You can find the link by expanding the inspection description (Ctrl+F1). The documentation states:

JFrog,维护许多Android项目使用的JCenter工件存储库的公司,最近宣布弃用JCenter,并即将退休.根据公告,JCenter将允许下载现有工件,直到2022年2月1日.

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.

在JCenter上发布工件的开发人员应开始将其软件包迁移到新主机,例如格式为 Maven Central .

Developers who publish artifacts on JCenter should start migrating their packages to a new host, such as Maven Central.

在不久的将来,我们将提供有关将Android项目迁移到其他地方的其他信息此页面上的JCenter.

In the near future, we will provide additional information about migrating Android projects away from JCenter on this page.

扩展的检查说明(以及上面的文档)建议将 jcenter()替换为 mavenCentral().Acually JCenter Maven Central 的超集,但是这种替换将无法解决问题,除非您的项目使用的所有 JCenter 工件都将被移动.到 Maven Central .

The expanded inspection description (as well as the documentation above) suggests to replace jcenter() by mavenCentral(). Acually JCenter is a superset of Maven Central, but such a replacement won't resolve the problem until all JCenter artifacts your project uses will be moved to Maven Central.

我认为最佳的解决方案是等到您使用的库从 jcenter()中移出,然后尝试用 mavenCentral()替换它.如果仍然缺少某些工件,请查看文档,可能是它们已移至另一个存储库,您也应该将其添加到 repositories 列表中.

I think the optimal solution would be to wait until the libraries you're using are moved from jcenter() and try to replace it with mavenCentral(). If some artifacts are still missing, take a look at the documentation, may be they are moved into another repository and you should add it to the repositories list as well.

repositories {
    google()

//  jcenter()       // <- removed
    mavenCentral()  // <- added
}

如果您是图书馆作者,则应迁移到另一个存储库,可能是 Maven Central .请注意,根据JCenter 弃用公告只允许在2021年3月31日之前提交新作品.

If you're a library author you should migrate to another repo, probably it would be Maven Central. Note that according to the JCenter deprecation announcement new submissions are allowed only until March 31st 2021.

一些相关资源:

这篇关于"JCenter生命将尽"android lint警告,替换什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆