In Android Studio, I am getting the following error when trying to run my app on an Android device:
The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-7.2-bin.zip' does not exist.
All my Android Studio projects are affected by this and restoring them to older commits does not change anything.
The problems all started by following the advice given here: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'
I deleted everything in my /.gradle/wrapper/dists/ folder. Now, I get the above error and I do not see how to solve it.
Here is how to reproduce it with Android Studio 2021.1.1 on Windows (but be warned: this might corrupt your projects, too):
- Delete everything in
/.gradle/wrapper/dists/
- Create a new project "Test" in Android Studio (this might take a while, since gradle-7.2-bin.zip will be downloaded in the dists folder)
- The project builds and runs without errors
- Close Android Studio
- Delete everything in
/.gradle/wrapper/dists/
again - Open project "Test" in Android Studio
- Try to run
Now you should get the above mentioned error.
At this point, /.gradle/wrapper/dists/
is still empty. Now you can do the following:
- run
gradlew tasks
in Terminal in the Project Folder of "Test" (this will take a while, since gradle-7.2-bin.zip will be downloaded in the dists folder again) - run
gradlew build
(everything should build without errors)
But clicking on "Run" still yields the same error.
I am getting the impression that this is an AndroidStudio / IntelliJ bug.
Can anyone help me with this?