skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

    Artic Fox started using another technique built on depedencyResolutionManagment which introduced this head-scratching situation where the entries in the application-level build.grade file are not searched.

    What worked for me in this situation was to go into settings.gradle (not build.gradle and change:

    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)

    to

    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

    and for good measure, I put my additional repository into settings.gradle resulting in the following:

    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) // WAS: FAIL_ON_PROJECT_REPOS
        repositories {
            google()
            mavenCentral()
            jcenter() // Warning: this repository is going to shut down soon
            maven {url 'https://mvnrepository.com'} // ADDED THIS
        }
    }
    

    After making these changes, the appropriate artifacts were automatically downloaded by the Android Studio standard build process.


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search