Android Studio Stuck on "Gradle: Resolve Dependencies '_Debugcompile'" or 'Detachedconfiguration1'

Android Studio stuck on Gradle: resolve dependencies '_debugCompile' or 'detachedConfiguration1'

I've encountered this problem far too frequently since i switched over to Android Studio. This is indeed an issue with the repository not being accessible - either due to a network issue or, more likely, the repo being down for whatever reason.

The simplest work-around that I've found is to just select the "work offline" mode within the Android Studio preferences. This doesn't help if you need to add a new dependency, but if you already have all your dependencies added it does the trick.

To enable this setting go to:

Preferences -> Gradle

In the right side options go down to "Global Gradel Settings" and check the "Offline work" box.

The box should look like:

Sample Image

You can periodically uncheck this box to see if the repo is back online.

NOTE: This option is the equivalent of setting the --offline flag when running a gradle build from the command line.

Android Studio stuck on gradle resolving dependencies

Killing the process or restarting the system helped me. Now it works perfectly fine...

P.S: A quote from the sitcom The IT Crowd:

Did you try turning it off and on again?

Gradle cannot resolve dependencies in Android Studio

I think that the problem you are hitting in Edit 3 is connected with those lines:

maven {
url "http://maven.hq.couchbase.com/nexus/content/repositories/releases/"
}

maven {
url "http://files.couchbase.com/maven2/"
}

Some of those repositories is not active any more, and Android Studio has no timeout when checking that (freakin crazy, right?!).

This was my issue at least:
Android Studio stuck on "Gradle: resolve dependancies '_debugCompile'" or 'detachedConfiguration1'

Android build gradle is too slow (Dependency Resolution)

The problem is solved !

After 2 days searching , I got the solution , so I would like to share with all people who may have the same problem. The problem is gradlecan not connect to center repository in some country. When you create a new project or import , your center repository is jcenter() by default and whenever you want to build or sync or add new external dependency, gradle is going to connect to https://bintray.com/ but it can not and the building process is going to wait till connect to jcenter(), so this process might take long time ( +30 min ) , even you can not add new dependency .

Solution :

  1. Make sure you have latest stable version ( current 2.0.0 )
  2. Make sure your gradle version is 2.0.0 in build.gradle (classpath 'com.android.tools.build:gradle:2.0.0')
  3. Final step and most important one is change your jcenter() to mavenCentral()

So you can easily add new dependency and sync project under 3sec !

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Have Fun



Related Topics



Leave a reply



Submit