Home » Android » Android Studio Keep saying Failed to complete Gradle execution

Android Studio Keep saying Failed to complete Gradle execution

Posted by: admin June 15, 2020 Leave a comment


Everything fine with the command line

gradle build

But Android Studio keep saying that

Failed to complete Gradle execution
A fatal exeption has occurred. Program will exit

If I clear all the cache, and restart everything will be fine, but this dialog will easily comeback again (after a build fail). I guess that the increment build chain is not good, but the message is not helpful at all.

Are there anythings I can do to get a more details message about what going on, why AndroidStudio Gradle failed? where can I put thing like --stacktrace in the Preferences of Android Studio?

How to&Answers:

If you got a problem like this in Android studio, then don’t worry about that, you are missing some thing which are here.

Go to File–>Setting–>Gradle–>Gradle Vm Option,
Now put this value -Xmx256m in the box, and hit the Apply button.

Here you have solved the problem.


At my case, I forgot to include some jars at Libs folder at the Gradle file, actually I forgot to add “.jar” to the end of jar file name.


In my case, it was not VM Option and Clean and Build did not work. My problem was that there were some images in res folder (so no grammatical errors) and Android Studio/IntelliJ return this error and saying nothing about images… check all external data sources in each file.