"No cached version... available for offline mode."

robin picture robin · Mar 24, 2014 · Viewed 189.1k times · Source

I received an error message while building a new Hello World project in Android Studio:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'MyApplication2'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:0.9.1.
     Required by:
         :MyApplication2:unspecified
      > No cached version of com.android.tools.build:gradle:0.9.1 available for offline mode.

BUILD FAILED

Android Studio version: 0.5.2

Gradle version: 0.9.1

I'm using a proxy connection to Internet.

Answer

friedrich picture friedrich · Jun 8, 2014

Had the same error after updating Android Studio today. For me, it wasn't a matter of proxy settings:

  1. Uncheck "Offline work" in Android Studio 0.6.0:

    File->Settings->Gradle->Global Gradle Settings

    or in OSX:

    Preferences->Gradle->Global Gradle Setting

    or in more recent versions:

    File->Settings->Build, Execution, Deployment->Build tools->Gradle

  2. Resync the project, for example by restarting the Android Studio

  3. Once synced, you can check the option again to work offline.

(Only tested in Gradle version 0.11... and Android Studio version 0.6.0 Preview)

EDIT : Added paths for different versions/platforms (as mentioned by John Ballinger and The_Martian). Not yet verified.