Nabdreas
Nabdreas

Reputation: 3467

No cached version of gradle

I am getting this error when syncing gradle. I am pretty new to gradle so can't figure out what is the problem exactly?

Error:No cached version of com.android.tools.build:gradle:0.10.1 available for offline mode.

When I go to Setting->Gradle, I have offline mode ticked off and using default gradle wrapper.

Upvotes: 27

Views: 36144

Answers (18)

cuzi
cuzi

Reputation: 1087

In Android Studio Jellyfish 2023.3 you have to click the little elephant button on top right of the screen to open Gradle and then find the crossed-out cloud symbol:

enter image description here

Upvotes: 0

Shubham Goel
Shubham Goel

Reputation: 2176

If the Android Studio Settings do not work (as with me) You can also try to set startParameter.isOffline=false in the settings.gradle file. Then Clean the project and Build again.

Upvotes: 0

Olga Konoreva
Olga Konoreva

Reputation: 1428

From Android Studio 4.1 there is a new location of the toggle offline mode.

enter image description here

Upvotes: 4

Rahul Shakya
Rahul Shakya

Reputation: 1425

I have different solutions since none of the above solution worked for me I don't know why (in macOS)

To disabled the offline mode since com.google.android.gms:play-services-base:17.1.0 No cached version available for offline mode

STEP: 1 Just make changes like

com.google.android.gms:play-services-base:17.1.1 in the gradle

STEP: 2 Which will pop Sync Now option

press Sync Now

STEP: 3 then in your build will appear (Disable offline mode and Sync)

Press Disabled offline mode and Sync and the offline mode will be disabled

STEP: 4 Change com.google.android.gms:play-services-base:17.1.1 to com.google.android.gms:play-services-base:17.1.0 then Sync again

It worked for me hope it helps you

Upvotes: 1

Sarmad Sohail
Sarmad Sohail

Reputation: 275

I faced the same issue when I updated my old version to Android Studio 4.0.
I solved it this way first of all. Go To
File -> Settings -> Appearance & Behavior -> System Settings -> HTTP Proxy
and select the option Auto-detect proxy settings and then click OK as shown in the picture below

Select Auto-detect proxy settings

After that go to Gradle window in the right-side tool window and disable the Toggle Offline Mode as shown in the picture below

Disable Gradle offline mode

At the end sync the gradle by hitting the Try again button at the top of the code window

Sync Gradle again

When you click on Try again it will pop the proxy window you just need to click on the Yes button and don't change anything and that's it. Your issue will be fixed.

Upvotes: 2

Umar Farooq
Umar Farooq

Reputation: 489

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. See below image for reference.

  • Shortcut key can also be set from settings as one is being shewn in image below that I've set.

Gradle Side menu with Offline toggle button

Upvotes: 3

Jack'
Jack'

Reputation: 2488

You can toggle offline mode by opening the Gradle panel on your right, and click the following button : enter image description here

Upvotes: 2

Khamidjon Khamidov
Khamidjon Khamidov

Reputation: 8879

enter image description hereIn newer versions of android studio offline mode toggle button can be found here.enter image description here

You can even customize to a shortcut in keymap if necessary. Just search 'offline mode' in Settingings -> Keymap

Upvotes: 0

GiridharaSPK
GiridharaSPK

Reputation: 547

I'm using Android Studio 3.6.3 I did not find the offline work option in Settings

Select Gradle in View > ToolWindows > Gradle or search Gradle on CTRL + SHIFT + A

There you can find a Toggle Offline Mode Button

Toggle Offline Mode Button in Gradle

Upvotes: 4

Naveen rana
Naveen rana

Reputation: 101

From Android 3.6 below is the path to change the offline mode.

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..

Upvotes: 1

If you have Android Studio 3.6(Stable). You can switch between cached version and online version of gradle.

Look at the right side of the Android studio, you will see gradle tab. Click on it.

enter image description here

enter image description here

If you cannot see gradle tab then

enter image description here

Upvotes: 28

denisaT
denisaT

Reputation: 21

I’ve also encountered this issue and from Android Studio 3.6 the setting changed and can be found in another window. As stated here:

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.

Here are the release notes: https://developer.android.com/studio/releases/#3.6-gradle-offline-ui

Upvotes: 1

WhatAJerk
WhatAJerk

Reputation: 579

I have Android Studio 3.6 Beta 1, so there is no checkBox offline mode in Gradle settings.

If somebody can't find it as well, here is the answer:

  1. Ctrl + Shift + "A"
  2. Type Gradle, then click Enter

You can toggle offline mode now

Upvotes: 55

Reaz Murshed
Reaz Murshed

Reputation: 24211

I thought I should post the latest update on where you should be able to find the option to disable your Offline Work in IntelliJ.

It's under your Preferences -> Build, Execution, Deployment

Uncheck Offline work and you should be fine.

enter image description here

Upvotes: 1

Mr X
Mr X

Reputation: 1063

I had the same problem in Android Studio v3.2.1.

This is working for me.

I updated Gradle version in build.gradle

 dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'//same as Android Studio vesion           
 }

and changed distributionUrl in gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

to

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

Upvotes: 0

Sheikh Hasib
Sheikh Hasib

Reputation: 7493

Disable offline mode to solve this error.

In Android studio:

File -> Other Settings -> Default Settings -> Build,Execution,Deployment -> Build Tools -> Gradle

Then uncheck Offline work and sync again.

Hope your issue will resolved.

Upvotes: 4

Colibri
Colibri

Reputation: 733

In my case I also had an additional "offline switch" to the one in Gradle.

Go to:

File > Settings > Build, Execution, Deployment > Compiler

There I've removed the --offline in Command-line Options. Earlier I was trying to speed up Android Studio a bit and this was one of the changes I had made.

Everything was fine after a restart then (and I have re-enabled both offline parts).

Upvotes: 26

Diaa Den
Diaa Den

Reputation: 1214

This problem occurs, if you have offline mode switched on in your IDE and let the IDE upgrade your build file to use 0.10.1 of the gradle plugin (that is needed for the new AS version. Since you have never build with this version, it cannot be found in the offline cache.

Go to File->Settings->Gradle (under Project Settings on the top) and disable the check in front of Offline Work (Section 'Global Gradle settings' at the bottom). Now it can download the version with the next build and afterwards you are free to use offline mode again, if you wish so.

Upvotes: 6

Related Questions