We are new gradle users, and we are trying to set up our TeamCity server to do CI builds of our Android project that has recently been migrated from ant scripts to Android Studio + gradle. We have integrated robolectric, and we are all able to build and test locally. However, when running the ‘test’ target from the build server, we keep getting the following:
com.mycompany.android.myapp.StringsTest > my_order_title_message_format STANDARD_ERROR
Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/android-all-4.3_r2-robolectric-0.pom from repository public at https://maven.mycompany.net/content/repositories/myapp
Unable to locate resource in repository
I don’t yet fully understand how gradle handles dependency management, but there’s something very confusing about the error message above. The URL referenced is defined only in an uploadArchives target under repositories.mavenDeployer (intended to be used to publish artifacts after doing an assemble build). I tried commenting out all of this code, building clean and then re-running tests, but I still end up with this same error message, and I have absolutely no clue who/what is referencing that URL. In our top level build.gradle file, we have the following:
allprojects {
repositories {
mavenCentral()
} }
in robolectric-tests/build.gradle, we have the following:
dependencies {
…
testCompile ‘org.robolectric:robolectric:2.4’ }
Even though I am running gradle with --info, I see no evidence that the tests are trying to download robolectric jars from maven central. I’ve also tried adding a repositories declaration (with mavenCentral as the one entry) to my robolectric-tests/build.gradle file with the same outcome. I’m very confused by all of this and could use any advice on how to resolve or troubleshoot why gradle is deciding to try to use the path to our archive upload location to download dependencies and doesn’t seem to be using maven central.