How to add an additional Maven repository to Android Studio build
I have added the following to the dependencies
part of my app build.gradle
implementation 'org.seleniumhq.selenium:selenium-htmlunit-driver:3.56.0'
But I get the error:
Could not find org.seleniumhq.selenium:selenium-htmlunit-driver:3.56.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/seleniumhq/selenium/selenium-htmlunit-driver/3.56.0/selenium-htmlunit-driver-3.56.0.pom
- https://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-htmlunit-driver/3.56.0/selenium-htmlunit-driver-3.56.0.pom
- https://jcenter.bintray.com/org/seleniumhq/selenium/selenium-htmlunit-driver/3.56.0/selenium-htmlunit-driver-3.56.0.pom
Required by:
project :app
So in the project build.gradle
file, I added to the repositories
section:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
// ADDED THIS 2021 12 17
maven {
url("https://mvnrepository.com")
}
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
}
}
I thought this would work because there's a page with selenium-htmlunit_driver_3.56.0 when I navigate there, the domain mvnrepository.com
, with my browser.
What I expected was that the specified dependency would be found. Or alternatively, I would get a report that would include another line under "Searched in the following locations:", but adding that maven line to the project build.grade has no effect.
What do I need to do in order for the additional maven repository to be searched? The maven repository that gets pulled-in from the mavenCentral()
entry (repo.maven.apache.org/maven2...) does not contain the version of selenium-htmlunit-drive that I'd like to try.
This is using Artic Fox 2020.3.1 Patch 3.
What am I doing wrong?
Try it with this URL: https://repo1.maven.org/maven2
The File is available here: Link
mvnrepository.com is only the frontend to search for dependencies, but not the file system with the jar-files themselves.