Gradle is failing on syncing my project in the new Android Studio 2.0

╄→гoц情女王★ 提交于 2019-11-27 05:27:59

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.

Shahzad Adil

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'
}

I also come with the same problem in my application. I have Done invalidate caches/restart then the problem is resolved.

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

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.

For me it was a connection issue, that I have checked my connection is working in the same second I have enabled and disabled offline Gradle, then Android Studio download the needed files

NB: My Connection was disconnecting and reconnecting many times, so i figured out that this error was caused by the connection specially it was not the same time it takes when trying to sync my Gradle

For those have issues with error message: Learn to configure HTTP settings, below is the solution that worked for me. Am using Android studio 2.3.3:

Go to http://developer.android.com/studio/intro/studio-config.html Step 1: Follow the instructions on: Set up Android studio proxy. Step 2: Follow the instructions on : Android plugin for gradle HTTP proxy setting. You will see proxy settings under : # project wide gradle settings, copy the code there and paste it into the empty space in gradle properties file which is under the build gradle in Android studio. Make sure you are connected to internet while on this process. Wait until the the error disappears.

Step 3: you may see another message pop up stating: some folders may have been missing syn now. Just click on syn now.

I hope this help, thanks all.

I was fallen the same trouble, you mentioned. But I solved it myself. I connected my pc to the internet and rebulit the project using PROJECT>>REBUILT PROJECT.

Then some downloads could be seen below with the name of jcenter.......

THEN THE PROBLEM SOLVED...😃 Gradle build became successful..

Rahul Bansal

I faced the same issue. Make sure that you have made an entry in path in environment variable for gradle

C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin

After disable offline mode and setting the path in environment variables, the issue was fixed and Gradle was build cleanly.

It seems there are multiple reasons for this issue. I fixed it by changing the "Gradle version" and "Android plugin version".

It might be helpful to someone. Go to File->Project Structure. Select Project and update your gradle and android plugin versions.

I also came with the same problem in my application..The application Gradle version is 2.3.3 .I just update the Gradle to 3.0.1 .and the problem is solved.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!