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

AndroidAndroid StudioGradleAndroid Gradle-Plugin

Android Problem Overview


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.

Android Solutions


Solution 1 - Android

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

  1. Resync the project, for example by restarting the Android Studio
  2. 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.

Solution 2 - Android

With the new Android Studio 3.6 to toggle Gradle's offline mode go to View > Tool Windows > Gradle from the menu bar and toggle the value of Offline Mode that is near the top of the Gradle window.

enter image description here

enter image description here

Solution 3 - Android

Please follow below steps :

1.Open Your project.

2.Go to the Left side of the Gradle button.

3.Look at below image.

enter image description here

4.Click button above image show.

5.if this type of view you are not in offline mode.

6.Go to Build and rebuild the project.

All above point is work for me.

Solution 4 - Android

Just happened to me after upgrading to Android Studio 3.1. The Offline Work checkbox was unchecked, so no luck there.

I went to Settings > Build, Execution, Deployment > Compiler and the Command-line Options textfield contained --offline, so I just deleted that and everything worked.

setting screenshot

Solution 5 - Android

I had same error...Please Uncheck the offline work in Settings.

File => Settings => Build, Execution, Deployment => Build Tools => Gradle => Offline Work

After Gradle Sync Finished, Please Restart Your Android Studio.

Solution 6 - Android

For mac, Uncheck Offline Work from Preference -> Build, Execution, Deployment -> Build Tools -> Gradle -> Global Gradle Settings

tip: cmd+, to open Preference via shortcut key

Solution 7 - Android

enter image description here

  1. click on right second one image .
  2. file -> invalidate and Restart .

It will work for me please try !!!

Solution 8 - Android

Since you mention you have a proxy connection I will tell you what worked for me: I went to properties (as friedrich mentioned) ensuring the Offline Work was unchecked. I opened up the gradle.properties file in the IDE and added my proxy settings. Here's a generic version:

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

Then at the top of the properties file in the IDE there was a "Try Again" link which I clicked. That did it.

Solution 9 - Android

New Solution (Due to the redoing of Android Studio)

File -> Settings -> Build, Execution, Deployment -> Compliler

In the line Command-line Options delete: --offline

Solution 10 - Android

In my case I get the same error title could not resolve all dependencies for configuration

However suberror said, it was due to a linting jar not loaded with its url given saying status 502 received, I ran the deployment command again, this time it succeeded.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionrobinView Question on Stackoverflow
Solution 1 - AndroidfriedrichView Answer on Stackoverflow
Solution 2 - AndroidjeprubioView Answer on Stackoverflow
Solution 3 - AndroidMEGHA DOBARIYAView Answer on Stackoverflow
Solution 4 - AndroidMartin MelkaView Answer on Stackoverflow
Solution 5 - AndroidSamir MangroliyaView Answer on Stackoverflow
Solution 6 - Androidtouhid udoyView Answer on Stackoverflow
Solution 7 - AndroidpritiView Answer on Stackoverflow
Solution 8 - AndroidTony DView Answer on Stackoverflow
Solution 9 - Androiduser_MGUView Answer on Stackoverflow
Solution 10 - AndroidAkshay Vijay JainView Answer on Stackoverflow