Jenkins: Could not resolve com.android.tools.build:gradle:2.2.2

1.1k views Asked by At

I have an Android Project to build using Jenkins. Jenkins is on a VM, so cannot access Internet. When I try to build the same, I am getting following error:

> Could not resolve com.android.tools.build:gradle:2.2.2.
     Required by:
         :LocationSensing:unspecified
      > Could not resolve com.android.tools.build:gradle:2.2.2.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom'.
               > This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server (jcenter.bintray.com)

How do I configure the gradle-2.2.2.pom file to work offline. I have downloaded this file, but not sure about configuring the same to work offline.

1

There are 1 answers

0
Vampire On

If you use the new plugin DSL in Gradle, you have to define a pluginRepository that is accessable by the build machine. If you want to specify a locally availble JAR file directly as dependency, don't use the new plugin DSL but the old-style way to add Gradle plugin JARs to the classpath of the buildscript and then apply the plugin manually.