programing

Android Studio : Gradle 실행을 완료하지 못했습니다. 원인이 비어 있습니다.

nasanasas 2020. 11. 4. 08:04
반응형

Android Studio : Gradle 실행을 완료하지 못했습니다. 원인이 비어 있습니다.


Android 에뮬레이터를 실행하려고하면 다음과 같은 오류 화면이 나타납니다. apk를 내보낼 때도 마찬가지입니다. apk가 저장 될 디렉토리로 이동하면 apk 파일이 없습니다.

감사합니다,
크리스토프

여기에 이미지 설명 입력


동일한 문제가 발생했습니다.이 문제는 아래 단계를 수행하여 해결됩니다.

이동

파일-> 설정-> Gradle-> Gradle Vm 옵션

Android Studio 1.2의 경우

파일-> 설정-> 빌드, 배포 및 실행-> 빌드 도구-> Gradle-> Gradle Vm 옵션

, 이제이 값 -Xmx256m을 상자에 넣고 적용 버튼을 누르십시오.


  1. Gradle에서 로그를 보려면 "Gradle Console"을 클릭하십시오.
  2. 오류 메시지에서 디버그
    • Mac : Android Studio에서 다음으로 이동합니다.
      • "우선권"
      • "빌드, 실행, 배포"
      • "컴파일러"
      • "명령 줄 옵션"에 "--stacktrace"추가

오류는 일반적으로 첫 번째 줄로 나열됩니다 (예 : Android Studio Gradle 콘솔에 대해 형식이 잘못 지정됨).

AGPBI : { "kind": "error", "text": "플로트 유형은 허용되지 않습니다 (\ u00270.75 \ u0027 값이있는 \ u0027icon_alpha_active \ u0027에서).", "sources": [{ "file": "/ Users / mingsheng / path / to / my / errenous / integers.xml ","position ": {"startLine ": 5,"startColumn ": 38,"startOffset ": 272,"endColumn ": 42,"endOffset ": 276}}], "원본": ""}

여기서 "text"= 오류 메시지, "sources : file"= 잘못된 파일 경로 / 이름

이 예에서는 정수 파일에 Float 값을 입력했습니다.


원인이 비어있는이 대화 상자는 리소스 (res) 디렉토리에 오류가있는 경우에도 나타납니다. 레이아웃 파일 등에 오류가 있는지 확인하십시오.


나도이 문제가 있었다. dimens.xml의 실수로 인해 발생했습니다 (git이 그것을 찾을 수 있도록 도와줍니다).

나는 사용했다

<dimen name="map_search_view_top_margin">100</dimen>

대신

<dimen name="map_search_view_top_margin">100dp</dimen>

도움이 되었기를 바랍니다.


이것은 XML 파일 어딘가에 실수입니다. 검사

values.xml
colors.xml
strings.xml
dimens.xml

닫는 대괄호를 여는 데 문제가 있거나이 파일에서 놓친 것입니다.


솔직히 말해서 위의 해결책 중 어느 것도 효과가 없었고 나는 거의 3 일 동안 이것을 놓고 싸웠습니다. 마지막으로 궁극적 인 해결책은 내 프로젝트를 백업하고, 스튜디오와 그 추적 파일을 완전히 제거하고, temp, % temp % 및 prefetch 폴더에서 파일을 지운 다음 다시 설치하고 마침내 작동했습니다.

Pls는 내가 가르친 위의 대답을 해결책 중 하나였습니다. 팀원 중 한 명이 코드를 bitbucket에 푸시하는 동안 git.ignore 파일을 포함하는 것을 잊었고 매번 해당 코드를 가져오고 gradle이 위의 문제를 해결하는 데 사용했기 때문에이 문제에 반복적으로 직면했습니다. 그리고 그것을 파악한 후 적절한 git.ignore 파일을 추가했으며 이제 any1의 PC에는 문제가 없습니다. :)


내 xml에 오타가있을 때 종종 그 오류가 발생합니다. Gradle 콘솔을 열고 나타나는 첫 번째 빨간색 선까지 스크롤하십시오. 정확한 문제를 알려줄 것입니다.


나도이 문제가있다. Gradle v.1.3.1을 사용했지만 Android Studio 버전은 v1.2.2입니다. Android Studio를 v.1.3.2로 업데이트하면 문제가 해결되었습니다.


제 경우에는 문제의 근원 이 일부 xml 파일이 참조하는 일부 리소스를 삭제 했습니다.이 경우 "Clear Project" "Rebuild Project" "Gradle VM Option"또는 "deleting .gradle folder"가 도움이되지 않았습니다. 모두.

더 말하면 언급 된 xml 파일이 사용 중이 아니고 오류가 표시되지 않았습니다. 필사적으로 Gradle을 동기화 한 다음 Gradle 콘솔을 열고 위로 스크롤하여 빨간색 오류 줄을 읽었을 때만 문제를 감지했습니다 .


어떤 솔루션도 나를 위해 일하지 않았습니다. 그래서 여기 에서이 해결책을 찾았 습니다 .

내 Android Studio는 JDK 1.8을 사용하고 있었기 때문에 JDK 1.7로 다시 전환했고 이제 작동합니다!

이동

파일> 프로젝트 구조> SDK 위치

I had JDK Location set as jdk1.8.0_05. I just changed it to jdk1.7.0_79 and everything works fine now.


I had the same issue. After an hour of struggle, it's finally fixed.

First I updated Android Studio to 1.3.2. That did not fix the problem immediately, but at least it gave a proper error when trying to run the application.

(for me, there was something wrong with JAR dependencies so I removed them and it's running now, but that's probably irrelevant)


When you have an error like this. Just move to your BOTTOM RIGHT corner of the screen there is something known as GRADLE CONSOLE open that and read what went wrong. That helped me.


Try to upgrade your android studio, and when you run your project again, it will tell you where the problem is.

For me, I encountered this problem several times, the first time is something wrong with the style.xml, and the second time is string.xml file. Anyway, It seems Android studio could not find something wrong with .xml file.

But anyway, try to "refresh" your Android studio and let it tell you where are the problems, even reinstall it.

good luck!


I had the same problem, and the problem was gone after upgrading my Android Studio from 1.2.1 to 1.5.1. There was no error even after adding --stacktrace --info to VM options. Gradle tasks would finish successfully, but the application just wouldn't launch (and studio would gray out the run button forever, probably waiting for a response from emulator). I had tried everything else mentioned here.


On newer version of AS 2.0 File->Setting->Build, Deployment &Execution-Compilers->Android Compilers->Gradle->Gradle Vm Option

put this as an option -Xmx256m


This can be because you have specified any command line option in android studio settings. You can check this by going to

File > Settings > Build, Execution, Deployment > Compiler

and see "Command-line-options" and check if anything is give. (In your case -x). If so remove it and click Apply and Ok. It worked for me...


I accidentally deleted string from string.xml and I didn't know it was specified in manifest for activity name, so spent one hour to discovered that out


I cleaned up the project, tried again and the problem was gone.


Android Studio의 여러 인스턴스가 열렸 기 때문에 Android Studio에서 "실행"문제가 발생했습니다. 그래서 모든 인스턴스를 닫고 APK를 생성하고 싶은 인스턴스 만 열었고 잘 작동했습니다. RAM에 문제가있을 수 있습니다.

참고 URL : https://stackoverflow.com/questions/27407855/android-studio-failed-to-complete-gradle-execution-cause-is-empty

반응형