Android Studio: Failed to complete Gradle execution. Supplied JAVA_HOME is not a valid folder

So I recently upgraded from Java 7 to Java 8, when I opened Android Studio, the below message popped up

Failed to complete Gradle execution.
Supplied JAVA_HOME is not a valid folder. You supplied /usr/lib/jvm/java-7-oracle

I was like, “what the heck!” since I already had changed my JAVA_HOME environment variable…

Turns out I also needed to change the JDK location in the Project Structure itself of Android Studio.

To change the location

  1. Open Android Studio
  2. Right Click the root of your project
  3. Click Open Module Settings
  4. On the left column, choose SDK Location
  5. Under JDK Location heading type your new Java location, in my case /usr/lib/jvm/java-8-oracle
  6. Click OK button and you should be able to continue developing

By the way, same steps for Windows and OSX

Have good and clean fun!!

Esau Silva
Software Engineer at Region One ESC
Full Stack Software Engineer working with Microsoft technologies, ReactJS is awesome and avid Brazilian Jiu-Jitsu practitioner
Spread the love

8 thoughts on “Android Studio: Failed to complete Gradle execution. Supplied JAVA_HOME is not a valid folder

  1. Rob says:

    Thank you for this info! I was having the same exact problem and this only took 30 seconds to fix!

  2. Salah says:

    Thank you ! you saved me a big time 🙂

  3. Claudia says:

    Thanks! Very helpful hint and a big time saver.

  4. Karthik says:

    This worked

Leave a Reply

Your email address will not be published. Required fields are marked *