Reputation: 6023
I am trying to import this project, even I tried to import other few projects too, I am getting below error.
https://github.com/ashdavies/data-binding
I have spent my 5 hours on it, even I tried many solutions on google but nothing gonna worked for me.
I tried following solutions, nothing worked.
1) delete .gradle directory
2) Restart IDE,
3) I tested with com.android.tools.build:gradle-experimental:0.7.0-alpha1
I am frustrated because of this Gradle and these issues.
Gradle Version : Gradle-2.13, I do not want to change this version.
Android Studio Version : Stable 2.1.1
Note : My other project is working fine and I can build it too.
Upvotes: 9
Views: 26254
Reputation: 1521
Sometimes it's a cache issue and sometimes due to interruption in download.
Step 1:
Try to download gradle distribution manually https://services.gradle.org/distributions/
and then go to project settings -> gradle -> and use the file which you've downloaded
Step 2:
If step#1 still not working, then it may be a cache issue. If you are a mac user, go to your finder user folder, show hidden items by pressing [Command + Shift + .] , Go to gradle folder and
Upvotes: 0
Reputation: 59
delete .gradle, .idea and gradle folder from the project and then invalidate cache and restart. problem will be resolved. Thanks :)
Upvotes: 0
Reputation: 152
In my case is that gradle-5.1.1-all.zip download failed, so I go to zipStoreBase+zipStorePath(configured in gradle-wrapper.properties, eg: E:\gradle-home\wrapper\dists), and delete the gradle-5.1.1-all directory, and let android studio to download that zip file again.
Upvotes: -1
Reputation: 3086
In my case, it was happening because i haven’t set the JDK path in environment variable. Please check from your Android studio studio that your JDK path is correct.
Go to Project Structure> SDK Location and check JDK Path. Give it the correct JDK path and also set the JAVA_HOME environment variable.
Upvotes: 1
Reputation: 2383
Go to any browser
type gradle and press enter
you can specify any version you want after the
gradle keyword
i am downloading gradle 3.3
https://services.gradle.org/distributions click on this link which is in description directly if you want
click on gradle 3.3 all.zip
wait for the download to complete
c://user/your pc name /.gradle/wrapper/dists
wait till extraction it takes 5 mins to complete
Now open your project in android studio
9.go to file > settings >bulid ,exec,deployment > gradle
use local gradle distributn
select the location where you had extracted gradle 3.3.zip
C:\Users\your pc name.gradle\wrapper\dists\gradle-3.3
click on OK
Now build starts again and
you can see now the build is successful and error is resolved
or
watch tutorial https://www.youtube.com/watch?v=u92_73vfA8M
Upvotes: 1
Reputation: 13431
Because your gradle path for project is incorrect. Go to ->Settings ->Gradle
and select "use default gradle settings" and than sync project. and issue will be resolved.
Upvotes: 0
Reputation: 2500
You can try this solution as i was facing this issue showing Error2 Gradle's dependency cache may be corrupt and gradle build not working and resolved it. Already answered this question on stack. You can reffer to this answer link
It includes firstly downloading latest graddle version from official site then replacing that unzipped file with home/yourUser/.graddle/wrapper/dists containg older version file on Mac.
Upvotes: 0
Reputation: 12976
You can try different workarounds for this problem :
1- Clean project and Rebuild it.
2- Before importing the project, remove the contents of the Build folders.
Then replace the contents of your gradle-wrapper.properties file with the following lines, to make it use a local distribution for building the project :
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=file\:/opt/gradle/gradle-2.13-all.zip
in which, the last line prevents android studio to download or use a corrupted gradle cache.
Upvotes: 5