Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no cached version available for offline mode

At office, I am behind a proxy. The internet access is restricted.

So I performed a gradle sync at home and copied the folder ".gradle" present at C:\Users\username.gradle from my home PC to the same location on my office PC.

Now on my office PC, I set gradle in Android Studio to "Work Offline" but still whenever I try to perform a gradle sync, I get an error stating

Error: Could not download google-services.jar (com.google.gms:google-services:3.0.0): No cached version available for offline mode 

However on digging through the ".gradle" folder I was able to locate the google-service.jar file at

C:\Users\username\.gradle\caches\modules-2\files-2.1\com.google.gms\google-services\3.0.0\32b833222c886ecfb37d79b1a05ce1eddb702db1 

I am not sure how to proceed. Please help.

like image 257
Mufaddal Gulshan Avatar asked May 24 '16 09:05

Mufaddal Gulshan


People also ask

How do I enable offline mode in Gradle?

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.

How do I disable Gradle offline mode and sync project?

(Build Tools -> Gradle)Then (uncheck -> Offline work) on the right. Click the OK button. Then Rebuild the Project.

How do I run Android studio in offline mode?

Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences). In the left pane, click Build, Execution, Deployment > Gradle. Check the Offline work checkbox. Click Apply or OK.


2 Answers

I had to dig for this a long time in the 2019.2 version. This option has moved in the UI. It is now in the toolbar of the gradle tools:

intellij gradle toolbar

see JetBrains documentation at https://www.jetbrains.com/help/idea/jetgradle-tool-window.html#offline

like image 96
Ocie Mitchell Avatar answered Oct 03 '22 06:10

Ocie Mitchell


This Error occurs when in your Android Studio's Gradle Tools Offline Mode option is Enabled.

enter image description here

When Enabled it lookes like this.

enter image description here

To fix it, you can Disable mode by clicking on the option shown in below screenshot.

enter image description here

like image 44
Shiv Buyya Avatar answered Oct 03 '22 06:10

Shiv Buyya