1

I'm trying to build my project in a new Jenkins job where I am updating the dependencies to Android API-27. Nevertheless, I'm always getting the folowing error:

:smartconnectapilibrary:compileDebugAidl Putting task artifact state for task ':smartconnectapilibrary:compileDebugAidl' into context took 0.0 secs. Creating new cache for metadata-2.23/artifact-at-url, path /Users/jenkins/.gradle/caches/modules-2/metadata-2.23/artifact-at-url.bin, access org.gradle.cache.internal.DefaultCacheAccess@100205c4 Resource missing. [HTTP HEAD: https://jcenter.bintray.com/com/android/support/support-v4/27.1.1/support-v4-27.1.1.pom] Resource missing. [HTTP HEAD: https://jcenter.bintray.com/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar] :smartconnectapilibrary:compileDebugAidl FAILED :smartconnectapilibrary:compileDebugAidl (Thread[Task worker for ':' Thread 4,5,main]) completed. Took 0.612 secs.

FAILURE: Build failed with an exception.

I have updated both entries to compileSdkVersion 27 and buildToolsVersion '27.0.3' everywhere, and added google() in the repositories section.

I have also read, that maybe Jenkins ignores the google() repository, so it never finds the dependency com.android.support:support-v4:27.1.1

Also, this is a composite project (one main module, and two library modules) each with their own gradle files. In each of them, I already have google() before jcenter() but still I have this issue and I think it may be in the way of how Gradle stacks the gradle files.

Does somebody know a solution?

UPDATE

I see that for some reason, Gradle is looking forcom.android.support:support-v4:27.1.1 in /jenkins/Library/Android/sdk/extras/ instead of /jenkins/.gradle/caches/modules-2/files-2.1/

  • What went wrong: Could not resolve all files for configuration ':fisherpriceapilibrary:debugCompileClasspath'. Could not find com.android.support:support-v4:27.1.1. Searched in the following locations: file:/Users/jenkins/Library/Android/sdk/extras/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.pom file:/Users/jenkins/Library/Android/sdk/extras/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar file:/Users/jenkins/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.pom file:/Users/jenkins/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar file:/Users/jenkins/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.pom file:/Users/jenkins/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar
    https://jcenter.bintray.com/com/android/support/support-v4/27.1.1/support-v4-27.1.1.pom https://jcenter.bintray.com/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar Required by: project :smartconnectapilibrary > project :someapilibrary
Jorge Gil
  • 4,265
  • 5
  • 38
  • 57
  • Would you please provide the `build.gradle` file? – Faysal Ahmed Aug 17 '18 at 04:33
  • Are you add this `maven { url "https://maven.google.com" }` on all project repositories. – Faysal Ahmed Aug 17 '18 at 04:34
  • @FaysalAhmed yes, I have added `google()` which is the same than `maven { url "https://maven.google.com" }`... actually I have tried both. This is not only one `build.gradle` file, they are multiple ones, because this is a composite project. – Jorge Gil Aug 17 '18 at 04:46

1 Answers1

1

This might sound a bit funny, but this has been a problem with Jenkins and Android projects in the past.

For some strange reasons, you have to prioritize the repositories to look into in your build.gradle. I say, this is not a great way of fixing this, but this will work for sure. I just ran into the same issue two days back.

Please look here for the answer: Failed to resolve: play-services-flags

Vighnesh Pai
  • 1,795
  • 1
  • 14
  • 38
  • Upon investigation, I found this: https://issuetracker.google.com/issues/80362794 – Vighnesh Pai Aug 17 '18 at 07:00
  • @VighneshPal thank you for your answer. I'm pretty much sure that my issue is quite related to this. Anyway, this is a composite project (one main module, and two library modules) each with their own gradle files. In each of them, I already have `google()` before `jcenter()` but still I have this issue and i think it my be in the way of how these gradles stack each other. I will update the question. – Jorge Gil Aug 17 '18 at 15:42
  • Finally, the issue was that I needed to place the google() above the jcenter() repository for each subproject. Subprojects are not showing the Gradle files of the root directory in Android Studio, so I haven't figured out about it on a first instance. – Jorge Gil Aug 20 '18 at 04:56