Android Studio: failed to complete gradle execution, cause is empty

JavaAndroidAndroid Studio

Java Problem Overview


When I try to run an Android emulator, I get the following error screen. The same occurs when I export the apk. When I go to the directory where the apk will be saved, the apk file is not there.

Thank you,
christophe

enter image description here

Java Solutions


Solution 1 - Java

I had the same issue, this problem will be fixed by doing the below step.

Go to

> File->Setting->Gradle->Gradle Vm Option

For Android Studio 1.2

> File->Setting->Build, Deployment &Execution->Build Tools->Gradle->Gradle Vm Option

, Now put this value -Xmx256m in the box, and hit the Apply button.

Solution 2 - Java

  1. Click "Gradle Console" for the log from Gradle.
  2. Debug from the error messages
  • Mac: In Android Studio, go to:
    • "Preference"
    • "Build, Execution, Deployment"
    • "Compiler"
    • Add "--stacktrace" to "Command-line Options"

Note the error will usually be listed as the first line (improperly formatted for Android Studio Gradle console such as: > AGPBI: {"kind":"error","text":"Float types not allowed (at \u0027icon_alpha_active\u0027 with value \u00270.75\u0027).","sources":[{"file":"/Users/mingsheng/path/to/my/errenous/integers.xml","position":{"startLine":5,"startColumn":38,"startOffset":272,"endColumn":42,"endOffset":276}}],"original":""}

Where "text" = error message, "sources: file" = errenous filepath/name

In this example, I have entered a Float value in the integers file.

Solution 3 - Java

This dialog box with empty cause also comes when there is some error in your resource(res) directory. Check for any error in layout files etc.

Solution 4 - Java

I had this issue too. It caused by mistake in dimens.xml (git helps me found it).

I used

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

instead

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

Hope it helps.

Solution 5 - Java

This is a mistake somewhere in your xml files. Check

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

Something wrong with opening closing bracket or something you missed in these files.

Solution 6 - Java

Honestly speaking, to me none of the above solutions worked and i almost fought over this for 3 days. Finally ultimate solution was to backup my project, uninstall studio and its trace files completely, clear files from temp, %temp% and prefetch folders and then reinstall all over again and finally it worked.

Pls discard my above answer which i taught was one of the solutions. I faced this problem repeatedly because 1 of my teammate forgot to include git.ignore file while pushing code to bitbucket and everytime i used to pull that code and then gradle used to pop the above problem. And after figuring out that, i have added proper git.ignore file and now there's no any problem on any1's pc :)

Solution 7 - Java

I am often getting that error when I have a typo in my xml. Open the gradle console and scroll up to the first red lines that appear. It will tell you the exact problem.

Solution 8 - Java

I have this problem, too. I used Gradle v.1.3.1 but Android Studio version is v1.2.2. Just update Android Studio to v.1.3.2 solved my problem.

Solution 9 - Java

In my case the root of the problem was, I deleted some resources that some xml files were refering to, and in that case neither of "Clear Project" "Rebuild Project" "Gradle VM Option" or "deleting .gradle folder" helped at all.

What more to say is, none of the mentioned xml files were in use, and no error was displayed anywhere. I only detected the problem when (in desperate) sync'ed Gradle, and then opened the Gradle console and scrolled up and read the red error lines.

Solution 10 - Java

None of the solutions worked for me. So I found this solution here:

My Android Studio was using JDK 1.8, so I switched back to JDK 1.7 and now it is working!

Go to

> File > Project Structure > SDK Location

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

Solution 11 - Java

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)

Solution 12 - Java

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.

Solution 13 - Java

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!

Solution 14 - Java

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.

Solution 15 - Java

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

Solution 16 - Java

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...

Solution 17 - Java

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

Solution 18 - Java

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

Solution 19 - Java

I had a "Run" problem in Android Studio due to multiple instances of Android Studio were opened. So I closed all instances and opened only on instances for which I wanted to generate APK.And It worked well. May be it had a problem with RAM.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3142817View Question on Stackoverflow
Solution 1 - JavaA JView Answer on Stackoverflow
Solution 2 - JavaMingshengView Answer on Stackoverflow
Solution 3 - Javasv_jan5View Answer on Stackoverflow
Solution 4 - JavaSiavAView Answer on Stackoverflow
Solution 5 - JavaViktor PetrovskiView Answer on Stackoverflow
Solution 6 - JavaAmit TumkurView Answer on Stackoverflow
Solution 7 - JavaBella YordanovaView Answer on Stackoverflow
Solution 8 - JavaSimon PanView Answer on Stackoverflow
Solution 9 - JavaMr. KroView Answer on Stackoverflow
Solution 10 - JavaRodrigo VenancioView Answer on Stackoverflow
Solution 11 - JavaIman AkbariView Answer on Stackoverflow
Solution 12 - JavaSagar DevangaView Answer on Stackoverflow
Solution 13 - JavaRobotCharlieView Answer on Stackoverflow
Solution 14 - Javan0rm1eView Answer on Stackoverflow
Solution 15 - Javavishal dharankarView Answer on Stackoverflow
Solution 16 - JavaJasmine JohnView Answer on Stackoverflow
Solution 17 - JavablackHawkView Answer on Stackoverflow
Solution 18 - JavaMustajab HaiderView Answer on Stackoverflow
Solution 19 - JavaKush PatelView Answer on Stackoverflow