Search code examples
androidmavenandroid-studiogradlejcenter

Migrating from jcenter to maven gives error: "Failed to resolve: org.adblockplus:adblock-android-webview:4.4.0"


I am trying to use this in my Android app:

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

bu putting this in my build.gradle:

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

It works fine if I have jcenter() listed in my build.gradle repositories. But I keep getting the warning JCenter is at end of life and so am trying to switch to maven.

But when I replace jcenter() with mavenCentral(), it doesn't work and gives me error:

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

I can see that the library is available on Maven here:

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

But yet Android Studio is unable to find it for some reason.

What am I doing wrong? I am very new to this so not familiar with repositories much.


Solution

  • If it's available in https://repo.maven.apache.org/maven2/, then you can use mavenCentral(). Otherwise it's not there in mavenCentral().

    https://mvnrepository.com just tells you which artifacts are available where. If you see at the bottom of https://mvnrepository.com/artifact/org.adblockplus/adblock-android-webview/4.4.0, it says "This artifact is located at JCenter repository (https://jcenter.bintray.com/)".

    In the attached pics, you can see which repo they are available. Adblock is present only in Jcenter. Whereas Apache Commons is present only in Central and not in JCenter.

    enter image description here

    enter image description here