IT박스

Gradle의 종속성 캐시가 손상되었을 수 있습니다 (이는 때때로 네트워크 연결 시간 초과 후에 발생합니다.)

itboxs 2020. 10. 31. 09:31

Gradle의 종속성 캐시가 손상되었을 수 있습니다 (이는 때때로 네트워크 연결 시간 초과 후에 발생합니다.)


이런 종류의 오류가 발생합니다.

Error:Unable to load class 'org.gradle.tooling.internal.protocol.test.InternalTestExecutionConnection'.
Possible causes for this unexpected error Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Android Studio를 2.3으로 업데이트했고 실행중인 프로젝트에 문제가 발생한 gradle 플러그인을 3.3으로 업데이트하도록 요청했습니다. 나는 모든 스택 솔루션 을 살펴 보았고이 해결 방법을 제외하고는 아무것도 작동하지 않았습니다 . gradle-wrapper.properties의 배포 URL을 이것으로 변경했습니다.

distributionUrl=https\://services.gradle.org/distributions/gradle--5.6.2-all.zip

내 프로젝트가 실행 중이며 gradle 빌드 도구 25.0.0 으로 업데이트하도록 요청했습니다 . 이제 모든 것이 괜찮습니다 :)

  1. 프로젝트 섹션으로 이동하여 gradle 스크립트 메뉴를 선택하십시오.
  2. 스크립트에서 메뉴 선택 gradle -wrapper.properties
  3. 그런 다음 distributionUrl = https : //services.gradle.org/distributions/gradle-2.2-all.zip을 "distributionUrl = https : //services.gradle.org/distributions/gradle-3.4.1-all.zip"으로 바꿉니다.

여기에 이미지 설명 입력참고 : 배포판 gradle은 Android 스튜디오 버전에 따라 변경됩니다.


인터넷에 연결되어 있는지 확인한 다음 :

1. 윈도우 사용자의 경우는 이동> C:\Users\username\.gradle\wrapper\dists

2. 리눅스 사용자의 경우는 이동 $HOME/.gradle (~/.gradle)(특정 프로젝트에서) 및 / 또는<PROJECT_DIR>/.gradle

3. 문제가있는 gradle 파일을 삭제합니다 (예 : 압축이 풀린 파일이없는 압축 폴더).

4. Gradle 파일과 프로젝트를 동기화합니다.


튜토리얼보기 https://www.youtube.com/watch?v=u92_73vfA8M

또는

단계를 따르십시오 :

  1. 모든 브라우저로 이동

  2. gradle을 입력하고 Enter 키를 누릅니다.

이후 원하는 버전을 지정할 수 있습니다.

gradle 키워드

나는 gradle 3.3을 다운로드하고 있습니다.

  1. https://services.gradle.org/distributions 원하는 경우 직접 설명하는이 링크를 클릭하십시오.

  2. gradle 3.3 all.zip을 클릭하십시오.

  3. 다운로드가 완료 될 때까지 기다립니다.

  4. 다운로드가 완료되면 해당 위치에 파일 압축을 풉니 다.

c : // 사용자 / PC 이름 /.gradle/wrapper/dists

  1. 추출이 완료 될 때까지 5 분 정도 기다립니다.

  2. 이제 Android Studio에서 프로젝트를 엽니 다.

9. file> settings> bulid, exec, deployment> gradle로 이동합니다.

  1. 이제 기본 gradle 사용을

로컬 gradle 배포판 사용

gradle 3.3.zip을 추출한 위치를 선택하십시오.

C : \ Users \ PC 이름 .gradle \ wrapper \ dists \ gradle-3.3

  1. 확인을 클릭하십시오

  2. 이제 빌드가 다시 시작되고

이제 빌드가 성공하고 오류가 해결되었음을 알 수 있습니다.


/.graddle/version/ 아래의 모든 폴더를 삭제하십시오.

이것이 내가 내 문제를 해결 한 방법입니다. 행운을 빕니다


수동으로 gradle을 설정하는 경우 프로젝트 build.gradle verison이 호환되는지 확인하십시오. 예를 들어 다음을 참조하십시오.

프로젝트의 build.gradle

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

수동 gradle 설정

수동 gradle 설정


손상된 파일 삭제

이 오류는 Gradle 파일이 다른 이유로 완전히 다운로드되지 않았거나 손상된 경우 발생하므로 파일을 다시 다운로드해야합니다. 쉬운 방법은 이전 파일을 삭제하는 것입니다.

C:\Users\username.gradle\wrapper\dists

프로젝트를 다시 빌드하면 Android Studio가 자동으로 새 파일을 다운로드합니다.


IDE (Android 스튜디오)를 "새로 고침"하기위한 다음 단계를 시도합니다.

1. 빌드 | 를 클릭하여 Gradle이 자동 생성 된 파일을 다시 빌드하도록합니다. Rebuild
2. 또한 Choose File | 캐시 무효화 / 다시 시작.


나는 graddle 3.3의 최신 버전을 다운로드 한 링크에서 현재 버전의 graddle을 다운로드 하여이 문제를 해결했습니다.

Then in next step i accessed .graddle/wrapper/dists dirctory from home directory on my Mac after showing up hidden system files and deleted previuos version folder residing there.

Now i put that downloaded latest version folder after uncompressing there. Now restarted Android studio and problem was resolved.


check out distributionUrl setting in gradle-wrapper.properties. I changed https to http, then my problem was solved.


You can try this

  1. first Open your Android Studio > open any project you're doing
  2. click on File > Settings > Build,Execution,Deployment > Gradle
  3. At Project-Level settings , there are 2 option to sync the gradle either usin the default or local.
  4. now change from default to a local gradle distribution > gradle Home

  5. select the path on your computer.

C:\Program Files\Android\Android Studio\gradle\gradle-4.1

  1. click on OK

  2. Now build starts again it should be solved.


In my case,just change http to https in the gradle-wrapper and Sync it.


Just reimport project. :) I tried cleaning up the cache and refreshing dependencies doesn't work but failed.


Clear .gradle folder and rebuild


Finally solved this problem.

If you just copy new version's files to old folder and override files,you may face the same question as me.

To solve it:

  1. makesure you saved your all settings.
  2. close AS,DELETE ALL files of your mixed version.
  3. extract new version to your empty folder.

It works for me.


If you have updated your android studio, then go to FILE, Project Structure, Project, then check gradle version. Before that check your gradle version in C:\Program Files\Android\Android Studio\gradle and check the version if it matches then sync again else change the gradle version in android studio and sync again.


I had a similar problem after cloning AnySoftKeyboard and opening it in Android Studio. What worked for me was deleting the AynSoftKeyboard/gradle folder and then cleaning the project via menu item Build > Clean Project.

So try deleting YourProject/gradle folder and clean the project to trigger a Gradle sync.

Hope it works for your case.


download gradle from here for your OS and extract the file and paste the inner folder into installLocation/gradle

than in Android Studio Goto File > Settings > bulid ,exec,deployment > gradle and choose local gradle option and provide the file path of your new downloaded gradle and hit ok it works :)


  1. delete C:\Users\Administrator.gradle\caches\xxx (xxx gradle version)
  2. rebuild

I had this problem i just deleted every thing related to android in c://user/your pc name / and it worked


If it has happened after upgrading Android Studio, It can be caused by an out of date buildtool, Update Android SDK BuildTools


  1. Open C:\Users\Username.gradle\wrapper\dists\

  2. Open latest gradle folder, e.g. gradle-4.1-rc-1-all

    You will find a random folder named 936kh1brdchce6fvd2c1o8t8x

  3. Download zip file of similar name

    eg: https://downloads.gradle.org/distributions/gradle-4.1-rc-1-all.zip

  4. Save it in this folder

  5. Restart Android studio

    It will automatically extract the zip folder and Error will clear


For Mac users

  1. open /Users/username/.gradle/wrapper/dists
  2. Check the latest gradle-4.4-all inside that directory
  3. Use the latest version and put it to gradle-wrapper.properties in Android Studio Project

In my case i was using distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip that is why I get the issue.

I change it to distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip and just sync again

Hope this will help.

thanks


Sometime problem is gradle wrapper file inside your project file. Open your current project gradle file and delete gradle wrapper.zip file and then sync project this will work.


Maybe you can run ./gradlew build -s in the terminal, the stacktrace would show you where went wrong.


This was my scenary: I had to use another Android Studio version (3.2.1) and the Gradle version was 4.6. For that, I downloaded the .zip version of Android Studio. At first it didn't work, even if I created a new project, Gradle wasn't working. But after some research and some help from this posts I did the following:

  1. I went to my gradle files route (android-studio\gradle) and deleted all the gradle-4.6 files.
  2. After that I went to gradle-wrapper.properties and got the Gradle version that I needed (gradle-4.6-all.zip).
  3. I went to the gradle site and look for the version that I needed.
  4. Downloaded and unziped it into my Android Studio's gradle file route, look step 1.
  5. I went to Android Studio settings (file/settings/Gradle) and change the option "Use default gradle wrapper (recommended)" to "Use local gradle distribution".
  6. I selected the route where I downloaded the Gradle version, that's step 4, and applied changes.
  7. Just in case, I used the "Invalidate Cache / Restart" option (file/ "Invalidate Cache / Restart").
  8. After that I used the "Sync project and Gradle files" and worked!

By the way, I am using Android Studio 3.2.1 zip version. I had the same problem when I tried to create projects with older Android Studio.

참고 URL : https://stackoverflow.com/questions/38442901/gradles-dependency-cache-may-be-corrupt-this-sometimes-occurs-after-a-network