Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Failed to complete gradle execution. Cause is empty

I tried setting different Gradle Vm Option from all the answers found on stackoverflow, but nothing seems to be working out I'm on Android Studio 1.2.2 I'm getting this error when I try to run the app on either on the emulator or the device.

Failed to complete gradle execution. Cause is empty

Only thing that is working for me is that I need to setup new project in different directories, but it only works for 3 instances and then bang, this error pops up. It is a tedious job to do above mentioned process for 10x times.

Edit_1 : I even tried invalidating caches/restart, doesn't work out

like image 766
Harsh Avatar asked Jun 19 '15 08:06

Harsh


3 Answers

Usually running gradle assembleDebug from hand or from Gradle menu (right side of screen -> app -> Tasks -> build -> assembleDebug) is giving much more info.

In my case it showed problems in resources files.

like image 91
Mateusz Pryczkowski Avatar answered Nov 15 '22 03:11

Mateusz Pryczkowski


It has happened to me and the cause has been different every time.

The first was an error in an xml file. I figured it out by reverting to the latest stable commit. The error was a missing "/>" closing tag. I don't know why android studio didn't point it out. This has happened to several of my co workers

The second time the fix was adding a line -Xmx256m or -Xmx512m

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

Hope it helps

like image 34
Andrea Aranguren Avatar answered Nov 15 '22 02:11

Andrea Aranguren


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 in my case...

like image 1
Jasmine John Avatar answered Nov 15 '22 01:11

Jasmine John