3
  1. After updating Android Studio 2.3.3 all this happing.
  2. I am creating a new Android Project after indexing and Gradle synchronization it shows an error Re-download dependencies and sync project(required network)
  3. when I click on click on Re-download dependencies and sync project nothing would happen it again shows error.
  4. I have also tried invalidate cache and Restart and also sync the Gradle but nothing happens
  5. I have also good connectivity of the internet.

enter image description here

Vishal Yadav
  • 1,020
  • 4
  • 15
  • 30

6 Answers6

5

It seems to be a gradle dependency cache problem. Unfortunately File | Invalidate Caches/Restart only cleans system cache as described here

To clean the gradle cache you need to run command

  • for Windows gradlew cleanBuildCache
  • for *nix ./gradlew cleanBuildCache

It will only clean cache related to your project. More details here

Another option is to delete gralde cache directory contents manually:

  • Windows: %USER_HOME%.gradle/caches
  • *nix: $HOME/.gradle/caches/
Amaksoft
  • 954
  • 9
  • 16
1

You can try this:

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

Replace the url in your project with this URL and then rebuild your project. Hope that works

1

You can just delete the gradle 2.3.3 in the ./gradle/dists/wrapper directory and close the project and open it again .. This will allow it to download it again

Jaba
  • 39
  • 3
0
  1. try to invalidate the cache and restart in android studio.
  2. for Windows gradlew cleanBuildCache.
  3. for Linux ./gradlew cleanBuildCache.

or try to delete cache using some cleaner like C cleaner.

Hardik Mehta
  • 867
  • 1
  • 12
  • 20
  • @VishalYadav from the error screen shot may be it seems internet or network problem. or you have entered wrong repository URL. or try https://stackoverflow.com/questions/38442901/gradles-dependency-cache-may-be-corrupt-this-sometimes-occurs-after-a-network or https://stackoverflow.com/questions/35101206/android-studio-re-download-dependencies-and-sync-project – Hardik Mehta Sep 08 '17 at 12:19
  • from where I can change repository url – Vishal Yadav Sep 08 '17 at 12:21
0

If you're on linux like me, starting studio with sudo from terminal does it.

sudo ./{path to studio}/bin/studio.sh
Harsh
  • 13
  • 1
  • 6
0

I have the same problem when I updated my Java SDK

I solve the issue by doing the following ...

Close your android studio

Delete the .gradle folder from home folder

Start Android Studio and it will forced to download the new .gradle

MANOJ AP
  • 1
  • 1