问题描述
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?
推荐答案
有一个文档部分描述了该问题: JCenter弃用和服务终止.您可以通过展开检查描述( Ctrl + F1
)来找到链接.该文档指出:
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:
在JCenter上发布工件的开发人员应开始将其软件包迁移到新主机,例如格式为 Maven Central .
Developers who publish artifacts on JCenter should start migrating their packages to a new host, suchas Maven Central.
在不久的将来,我们将提供有关将Android项目迁移到其他地方的其他信息此页面上的JCenter.
In the near future, we will provide additional information about migrating Android projects away fromJCenter 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的生命尽头& quot;android lint警告,替换什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!