Gradle is failing on syncing my project in the new Android Studio 2.0
Solution 1:
Ok, I fixed my issue so I wanted to post how I did it in case somebody else runs into this situation.
I was googling around and found a statement regarding working offline with Android Studio that read:
You can, however you won't be able to use any Gradle dependency. Gradle search into the repositories for dependencies using internet, so if you're completely unable to work online. Try not to include anything in the Gradle files, if you do, you'll have to sync it and it'll fail. Bascially just don't touch Gradle files and you'll be good to go.
So, I looked at my gradle files, specifically the build.gradle for the Project (not for the Module). Once there, I noticed a line:
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
So, I replaced 1.3.0
with 2.0.0
and the project built just fine.
I hope this helps somebody else in the future. Good luck.
Solution 2:
I got same problem when I downloaded "BackboneExampleApp" source code from guithub Click Here For Code. I have done following process by watching settings of my old projects and found these errors. I resolved both errors, run my app and got errors to upgrade project and finally when I updated then no more problems exist. Just see pictures for help.
build.gradle (Project:BackboneExampleApp-master)-->
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
Solution 3:
I also come with the same problem in my application. I have Done invalidate caches/restart then the problem is resolved.
Solution 4:
I had the same problem as yours. Fortunately, I managed to solve it. You need to go to File >> Settings >> Build, Execution, Deployment >> Build Tools >> Gradle. You need to change the Gradle Home. Mine was "C:/Program Files/Android/Android Studio/gradle/gradle-2.08" and it said the path is invalid. So, just recheck your path in your file explorer and change it. I changed mine to "C:/Program Files/Android/Android Studio/gradle/gradle-2.10".
Solution 5:
I had a similar problem. I was trying to build one of the media samples. I tried to use gradle 2.0.0 as you suggested but it didn't work. Got me on the right track though. gradle 2.1.0, along with deactivating offline mode got it to work.