Everything fine with the command line
gradle build
But Android Studio keep saying that
Failed to complete Gradle execution
Cause:
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?
Then open Android Studio and go to File > Settings > Build, Execution and Deployment > Gradle > Use Gradle from > Set the path of the downloaded Gradle. Step 4. Now try syncing the Gradle again and check if the error still persists.
Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With