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

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

Posted by: admin June 15, 2020 Leave a comment

Questions:

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

How to&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.

Answer:

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

Answer:

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…

Answer:

Downgraded to version 1.0.1 to make everything work flawlessly. I’m using same project files, it works fine on this version n number of times and same project files are giving above empty error on studio version 1.2.2

Answer:

If you are deleting the resources like the layouts or strings or anything. Make sure everything is deleted properly every dependency is deleted properly.A thorough clean up. That solved the problem for me

Answer:

The cause is empty because the problem is in your resources xml or manifest