Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

rigzin norboo
rigzin norboo
11,059 Points

Error : Failed to complete Gradle execution.

When ever i try to launch emulator , box pop up saying (Failed to complete Gradle execution.Cause:A fatal exception has occurred. Program will exit). i googled it and tried this- File ->Settings -> Gradle "Gradle VM options:" box: -XX:MaxHeapSize=256m -Xmx256m But it shows: (Failed to complete Gradle execution.Cause:Could not find or load main class box:)

6 Answers

I had this same error several times yesterday. What I did is turn android studio off...and remove the gradle and .gradle file from my project file (the one I was working on through my user directory) and then...I turned on Android studio, tried to run my project and it gave me a new error that I need some type of version of gradle. I then turned off android studio and went and re-added the gradle and .gradle files to my project file, turned on android studio and ran the project. That fixed it. I am not sure if it will work for you but you can try it.

rigzin norboo
rigzin norboo
11,059 Points

are u talking about gradle and .gradle folder in the directory

Well lets say your project name is.... "FirstApp" and your workspace is at C://Users/Chimed/Android Studio/ ... you find the folder C://Users/Chimed/Android Studio/ FirstApp and there you will see a gradle and .gradle file in it.

rigzin norboo
rigzin norboo
11,059 Points

after doing your method their is no error but emulator is still not popping up

Do you see any thing written in the logcat when you try to run the emulator? Did the gradle completed its course? It takes some minutes or seconds for it to load.

rigzin norboo
rigzin norboo
11,059 Points

their is nothing in the logcat , result of gradle is Build sucessful 0 error 0 warning. I have waited 15min for emulator.

Can you restart your computer or close android studio and kill its process (if it is still running on task manager) then try again?

rigzin norboo
rigzin norboo
11,059 Points

Still not working In Run console - Waiting for device "C:\Users..... "

Did you add the files back in as I said? This is pretty strange especially if it gives you no error.

rigzin norboo
rigzin norboo
11,059 Points

Hey finally after 7-8 min emulator worked. Thank you very much. I appreciate your help.

You are welcome :)