問題描述
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 工件,它會導致 Could not resolve all artifacts
錯誤.解決此警告的正確方法是什么?
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:
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 中心.
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()
.實際上 JCenter 是 Maven Central 的超集,但是在您的項目使用的所有 JCenter 工件都被移動之前,這樣的替換不會解決問題到 Maven 中心.
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
}
如果您是庫作者,您應該遷移到另一個 repo,可能是 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 &Bintray 正在關閉.現在呢?
- 從 JCenter 遷移
這篇關于“JCenter 即將報廢"android lint 警告,替換是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!