Gradle Is Failing on Syncing My Project in the New Android Studio 2.0

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

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.

Gradle Project sync failed - Android Studio Gradle Build 2.20

The Android gradle plugin is in BinTray, not Maven Central (https://repo1.maven.org/maven2)

Replace mavenCentral() with jcenter() in the bulid.gradle repositories section

Also add google() or maven { url 'https://maven.google.com' } if using Gradle version < 4.0

Refer:

  • https://developer.android.com/studio/build/dependencies.html#remote_repositories
  • https://developer.android.com/studio/build/index.html#settings-file

Gradle project refresh failed after Android Studio update

Most people do not read the comments so to summarize (Thanks to @Industrial-antidepressant and @wrecker):

As suggested in a bug ticket you should try the following:

  1. Close Android Studio
  2. go to android-studio/plugins/gradle/lib
  3. Delete (or better move them somewhere to have a backup) all gradle-*-1.8 files
  4. Start Android Studio again and rebuild/refresh.

It should work. Make sure to star the above bug ticket to get informed.

Little tip:
Try the new compile setting Settings -> Compiler -> Gradle and activate the third in-process build for a speed up. Depending on your project setting you might want to select the first one as well. With that my project build time reduced to 2-4 seconds (before 20+ seconds).



Related Topics



Leave a reply



Submit