Nice programing

Android 스튜디오가 'Gradle :'_debugCompile '종속성 해결'또는 'detachedConfiguration1'에서 멈춤

nicepro 2020. 12. 11. 19:25
반응형

Android 스튜디오가 'Gradle :'_debugCompile '종속성 해결'또는 'detachedConfiguration1'에서 멈춤


내 프로젝트에서 무엇을 변경했는지 모르겠지만 gradle 스크립트를 작성하는 동안 갑자기이 단계를 통과 할 수 없습니다.

'gradle assemble'만으로 구축하는 데 문제가 없습니다.

편집 : 이전 고착 지점은 종속성 'detachedConfiguration1'을 해결했습니다. (_debugCompile의 첫 번째 시도가 실패한 후 detachedConfiguration1로 돌아 왔습니다). 너무 많은 종속성 프로젝트라고 생각합니까? 내가 가지고있는 일부 샘플 프로젝트는 Studio에서 잘 가져 왔습니다 .... Android Studio를 다시 설치하고 모든 설정과 환경 설정도 제거했습니다.

이 일을 시작할 때마다 죽여야합니다.

종소리?

import com.android.build.gradle.AppPlugin
import com.android.build.gradle.LibraryPlugin

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript {
repositories {
    mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:0.9.+'
}

apply plugin: 'android'

repositories {
    maven { url 'http://ksoap2-android.googlecode.com/svn/m2-repo' }

    mavenCentral()
}

dependencies {

    compile 'com.google.code.ksoap2-android:ksoap2-android:2.5.2'
    compile 'com.android.support:support-v4:18.0.+'
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':lib-projects:StickyListHeaders')
    compile project(':lib-projects:ActionBar-PullToRefresh')
    compile project(':lib-projects:facebook')
    compile project(':lib-projects:Mopub:mopub-sdk')
    compile project(':lib-projects:NineOldAndroids')
    compile project(':lib-projects:ActionBarSherlock:actionbarsherlock')
    compile project(':lib-projects:ActionBarSherlock:actionbarsherlock-i18n')
    compile project(':lib-projects:SmoothProgressBar')
    compile project(':lib-projects:android-viewflow-master:viewflow')
}

android {

    signingConfigs {

        debug {
            storeFile file('....')
        }
    }

    compileSdkVersion 19
    buildToolsVersion "19.0.3"
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        //instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...

        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')

    }
}

Android Studio로 전환 한 이후로이 문제가 너무 자주 발생했습니다. 이것은 실제로 저장소에 액세스 할 수없는 문제입니다. 네트워크 문제로 인해 또는 어떤 이유로 든 저장소가 다운되었을 가능성이 높습니다.

내가 찾은 가장 간단한 해결 방법은 Android Studio 환경 설정에서 "오프라인으로 작업"모드를 선택하는 것입니다. 새 종속성을 추가해야하는 경우에는 도움이되지 않지만 이미 모든 종속성을 추가 한 경우 트릭을 수행합니다.

이 설정을 활성화하려면 다음으로 이동하십시오.

환경 설정-> Gradle

오른쪽 옵션에서 "Global Gradel 설정"으로 이동하여 "오프라인 작업"상자를 선택합니다.

상자는 다음과 같아야합니다.

여기에 이미지 설명 입력

주기적으로이 상자의 선택을 취소하여 저장소가 다시 온라인 상태인지 확인할 수 있습니다.

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


It turns out that this line:

repositories {     
  maven {     
    url 'http://ksoap2-android.googlecode.com/svn/m2-repo'    
  }

is solely responsible for forever-stuck Android studio. Probably the repository is not active/offline today...

Interesting questions:

  1. How come the gradle scripts work just fine in Terminal? (though it seemed slower than usual).

  2. How come THERE IS NO TIMEOUT for that? It surely created a few white hairs today.. ;)


Please run gradle from command line (opening a terminal in your project folder) using -info and check where it stop. I was experiencing something similar and it was related with jcenter(), because it can't reach a resource:

Resource missing. HTTP GET

so, changing jcenter() by mavenCentral() in MyProject/build.gradle did the trick.

I hope it can help.


I encountered the same issue and resolved it by adding both http and https proxies in the gradle.properties file. It is important to add the https proxy as the gradle-2.10-all.zip is read using https:

https://services.gradle.org/distributions/gradle-2.10-all.zip

gradle.properties:

systemProp.http.proxyHost=<http proxy name>
systemProp.http.proxyPort=<http proxy port>
systemProp.https.proxyHost=<https proxy name>
systemProp.https.proxyPort=<https proxy port>

On the Debian,

I have the same problem, fixed for me with two changes,

First enable proxy for gradle on the gradle.properties file, both for http and https:

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8080

And then next by installing lib32stdc++6 and lib32z1 packages:

$ sudo apt-get install lib32stdc++6 lib32z1

I discover my problem with enabling debug and info option for gradlw command, that I run it on the root of project:

First with this command:

./gradlew --info --debug 

And next with this command:

./gradlew --info --debug :app:generateDebugSources

Output debug (On Android Gui this section run again and agian on the background without you know about error message ):

23:25:45.419 [ERROR] [system.err] Exception in thread "png-cruncher_10" java.lang.RuntimeException: Timed out while waiting for slave aapt process, make sure the aapt execute at /local/path/to/Android/sdk/build-tools/22.0.1/aapt can run successfully (some anti-virus may block it) or try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
23:25:45.419 [ERROR] [system.err]   at com.android.builder.png.AaptProcess.waitForReady(AaptProcess.java:108)
23:25:45.419 [ERROR] [system.err]   at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:110)
23:25:45.419 [ERROR] [system.err]   at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
23:25:45.419 [ERROR] [system.err]   at java.lang.Thread.run(Thread.java:745)

Check http://bintray.com (jcenter) or http://maven.org (mavenCentral) from your browser and change repositories setting in the build.gradle according to available site.


If you are using a proxy server then you might have to set the JVM parameters for your proxy.

Settings -> Gradle -> Gradle VM options: -Dhttp.proxyHost=1.2.3.4 -Dhttp.proxyPort=8080 Settings -> Compiler -> VM options: -Dhttp.proxyHost=1.2.3.4 -Dhttp.proxyPort=8080

I had to restart the IDE for these settings to take effect.


I fixed mine by copying the Gradle settings in a working project and pasting them into the bad build.gradle file.


I've got similar problem today, and in my case I found it is because one of my external dependencies have difficulty being pulling from the internet.

Here's how I solved it:

Step 1

Check the dependencies in build.gradle files in the app (or the library modules, according to where your problem occured).

For example, it might look like this:

dependencies {
    ...
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.amazonaws:aws-android-sdk-iot:2.2.20'
}

Step 2

Guess which ones might be the root cause (ie. the one which looks harder to pull).

In my case, I think 'com.amazonaws:aws-android-sdk-iot:2.2.20' looks suspicious, so I comment it out and then try to build Gradle again. This time, the Gradle build is successful.

Step 3

Search for other artifact versions.

In my case, I searched https://bintray.com/bintray/jcenter/com.amazonaws%3Aaws-android-sdk-iot and found 2.2.21, 2.2.22 are also available (currently).

I tried 2.2.21 in my build.gradle, and the Gradle build works now!!

dependencies {
    ...
    compile 'com.amazonaws:aws-android-sdk-iot:2.2.21'
}

Other References

To know more about external dependencies in Gradle, check these sites:


다른 사람들이 다음 시나리오에 부딪 힐 경우를 대비하여 내 경험을 제공합니다.

나에게 문제는 내 저장소 중 하나가 공용 네트워크가 아닌 회사 네트워크에서 호스팅된다는 것입니다. VPN 연결 후 "종속성을 해결"할 수있었습니다.

참고 URL : https://stackoverflow.com/questions/23837465/android-studio-stuck-on-gradle-resolve-dependencies-debugcompile-or-detac

반응형