首页 > 解决方案 > 从 jcenter 迁移到 maven 出现错误:“无法解决:org.adblockplus:adblock-android-webview:4.4.0”

问题描述

我正在尝试在我的 Android 应用程序中使用它:

https://github.com/adblockplus/libadblockplus-android

bu把它放在我的build.gradle中:

implementation 'org.adblockplus:adblock-android-webview:4.4.0'

如果我jcenter()在我的 build.gradle 存储库中列出,它工作正常。但我不断收到警告JCenter is at end of life,所以我试图切换到maven.

但是当我用 替换jcenter()mavenCentral(),它不起作用并给我错误:

Failed to resolve: org.adblockplus:adblock-android-webview:4.4.0

我可以看到该库在 Maven 上可用:

https://mvnrepository.com/artifact/org.adblockplus/adblock-android-webview/4.4.0

但是由于某种原因,Android Studio 无法找到它。

我究竟做错了什么?我对此很陌生,所以对存储库不太熟悉。

标签: androidmavenandroid-studiogradlejcenter

解决方案


如果它在https://repo.maven.apache.org/maven2/中可用,那么您可以使用mavenCentral(). 否则它不存在于mavenCentral().

https://mvnrepository.com只是告诉您哪些工件在哪里可用。如果您在https://mvnrepository.com/artifact/org.adblockplus/adblock-android-webview/4.4.0的底部看到,它会显示“此工件位于 JCenter 存储库 ( https://jcenter.bintray. com/ )”。

在随附的图片中,您可以看到它们可用的存储库。Adblock 仅存在于 Jcenter 中。而 Apache Commons 仅存在于 Central 而不是 JCenter。

在此处输入图像描述

在此处输入图像描述


推荐阅读