158

I am new to android studio IDE development. Every time when I imported a sample project that developed in the android studio, I am getting this error..

No cached version of com.android.tools.build:gradle:1.1.0 available for offline mode. Disable Gradle 'offline mode' and sync project.

How can I solve this problem.

Ganapathy C
  • 5,989
  • 5
  • 42
  • 75
Loganathan
  • 1,864
  • 3
  • 12
  • 17
  • 1
    You may have not downloaded gradle entirely. – Apurva Feb 25 '15 at 06:01
  • How can I check whether gradle downloaded or not. @Apurva. – Loganathan Feb 25 '15 at 06:10
  • Stay connected to internet while you open project in android studio. It will automatically download all required components – Apurva Feb 25 '15 at 06:11
  • This problem happened only while importing the project. @Apurva – Loganathan Feb 25 '15 at 06:13
  • 3
    If you are using Android Studio 3.6 then refer this link: https://stackoverflow.com/a/60483387/5582162 – pravingaikwad07 Mar 04 '20 at 18:10
  • I was looking for a way to disable "offline mode". Found many answers recommending to toggle it from preferences, but there were no "offline mode" checkbox there. The solution was to click on gradle toolbar on the right side of android studio and click on the pipe (toggle offline mode) button. – Redar Mar 06 '20 at 12:34
  • In Android Studio 3.6.3, Go to View-> Tool Windows-> Gradle and from that click on "Toggle Offline Mode" Button then Rebuild the Project – Negar May 18 '20 at 11:35
  • 4
    New location to toggle Gradle's offline mode To enable or disable Gradle's offline mode, first select View > Tool Windows > Gradle from the menu bar. Then, near the top of the Gradle window, click Toggle Offline Mode Gradle offline button in the Gradle panel.. https://developer.android.com/studio/releases/#3.6-gradle-offline-ui – Vikas Pandey Sep 09 '20 at 07:02

5 Answers5

263

New location in Android Studio 3.6+

View > Tool Windows > Gradle from the menu bar.

Then, near the top of the Gradle window, click Toggle Offline Mode Gradle offline button in the Gradle panel.


Old answer

On Windows:-

Go to File -> Settings.

And open the 'Build,Execution,Deployment'. Then open the

Build Tools -> Gradle

Then uncheck -> Offline work on the right.

Click the OK button.

Then Rebuild the Project.

On Mac OS:-

go to Android Studio -> Preferences, and the rest is the same. OR follow steps given in the image

[For Mac go 1

enter image description here

Blundell
  • 75,855
  • 30
  • 208
  • 233
独步清风
  • 2,646
  • 1
  • 10
  • 4
  • thanks mate you really solved my issue thanks a lot again :) – Sudhanshu Gaur Dec 06 '15 at 18:47
  • Is there any IDE performance gains when running Android Studio in offline mode? – W.M. Feb 21 '17 at 08:19
  • @W.M., Yes, Check the security holes frequently reported in Android Studio group which can only be used if you are working online. – AaA Jul 05 '17 at 03:34
  • 30
    This answer is no longer correct for Android Studio 3.6+. The location of "Offline mode" has been changed. [Reference](https://developer.android.com/studio/preview/features?utm_source=android-studio-4-0&utm_medium=studio-assistant-preview#gradle-offline-ui) – musooff Jan 02 '20 at 02:32
  • 5
    With Android Studio 3.6.1 I miss this toggle – hannes ach Mar 11 '20 at 08:23
  • 2
    Hey @hannesach, after reading https://issuetracker.google.com/issues/151280278 I have discovered the solution reading the release notes https://developer.android.com/studio/releases/#3.6-gradle-offline-ui – Filipe Bezerra de Sousa Mar 25 '20 at 21:06
  • 64
    New location in Android Srudio 3.6+ **View > Tool Windows > Gradle** from the menu bar. Then, near the top of the Gradle window, click Toggle Offline Mode Gradle offline button in the Gradle panel. [link](https://developer.android.com/studio/releases/#3.6-gradle-offline-ui) – Abdelalim Hassouna Apr 21 '20 at 09:10
  • @AbdelalimHassouna thanks! Even Google's documentation doesn't show the correct instructions ! https://developer.android.com/studio/intro/studio-config#low_memory it still shows to look in `Build, Execution, Deployment` – Someone Somewhere Jun 17 '20 at 21:17
  • 1
    In Android Studio 3.6 (or above) Click on the Gradle Button Which is at right side, it will open up small window, here click on the “Toggle Offline Mode” icon for enable or disable toggle. – Umar Farooq Aug 08 '20 at 12:32
  • Right click "Reload Gradle Project" maybe needed after toggle offline mode – Ivan Chau Apr 30 '21 at 03:53
  • 3
    There is no such option as **Offline Mode** in Android Studio. – IgorGanapolsky May 03 '21 at 17:27
  • 1
    For newer version android studio Arctic fox 2021.3.1 or newer click on gradle at the right side of your screen and there will be toggle button for offline mode. – Adam Noor Aug 24 '21 at 08:56
  • 1
    Please look here for Android studio 4.0+ https://stackoverflow.com/questions/64635762/what-is-disable-offline-mode-and-disable-gradle-offline-mode-and-this-settin – sadat Dec 13 '21 at 03:11
  • In case anyone is still wondering where to find it here is the linkfor reference. https://developer.android.com/studio/releases/#3.6-gradle-offline-ui – Tushar Srivastava Jan 21 '22 at 06:45
24

Edit. As noted in the comments, this is no longer working with the latest Android Studio releases.

The latest Android studio seems to only reference to "Offline mode" via the keymap, but toggling this does not seem to change anything anymore.


In Android Studio open the settings and search for offline it will find the Gradle category which contains Offline work. You can disable it there.

Gradle Offline work

mikepenz
  • 12,708
  • 14
  • 77
  • 117
  • Is this the same as specifying `mavenLocal()` in **build.gradle**? – IgorGanapolsky Mar 30 '16 at 16:56
  • 1
    No `mavenLocal()` will result in gradle trying to find files in your local repo, if it can't find the library there it will fallback to `mavenCentral()`. The above will completely stop gradle from doing network calls to search for libs. If it hasn't the lib in the cache it will fail – mikepenz Mar 30 '16 at 18:26
  • 1
    @JqueryNinja I just checked. The offline work is still at the same place even with Android Studio 2.1.x – mikepenz Jun 21 '16 at 11:47
  • @mikepenz True true, that in addition, so I guess doing what I suggested also helps cause I was able to load images and maps. On demad slows down loading app onto phone and drawing maps/loading images – iOSAndroidWindowsMobileAppsDev Jun 21 '16 at 11:58
  • 4
    this is now no longer an accurate answer – Someone Somewhere Jun 17 '20 at 21:06
23

Gradle is in offline mode, which means that it won't go to the network to resolve dependencies.

Go to Preferences > Gradle and uncheck "Offline work".

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
  • 10
    There is no preferences toolbar in my android studio, what to do? Maybe i am not able to find it . Please help – Utkarsh Dixit May 30 '15 at 06:10
  • n.b. There is no Preferences menu. You need to go to File > Settings as explained in the other answers. – Brian Jul 29 '15 at 20:58
  • 2
    are you kidding with me you must tell accurate path because no one knows where is preferences see below answer >_ – Sudhanshu Gaur Dec 06 '15 at 18:47
  • Late comment: This answer is for Eclipse / Spring Tools Suite IDE not android studio, and the path is Window>Preferences>Gradle. Then check or uncheck the "Offline Mode" checkbox. – geneSummons Nov 15 '17 at 18:12
  • Go to the upper right corner. You will find it there. – Xserge Apr 17 '23 at 19:23
17

@mikepenz has the right one.

You could just hit SHIFT+COMMAND+A (if you're using OSX and 1.4 android studio) and enter OFFLINE in the search box.

Then you'll see what mike have shown you.

Just deselect offline.

bish
  • 3,381
  • 9
  • 48
  • 69
Jdi.Zhang
  • 171
  • 1
  • 5
4

Offline mode could be set in Android Studio and in your project. To verify that gradle won't build your project in offline mode:

  1. Disable gradle offline mode in Android Studio gradle settings.
  2. Verify that your project's gradle.settings won't contain: startParameter.offline=true
ox_
  • 805
  • 1
  • 7
  • 14