5

i just imported some project that i bought from my friend. Once i import it to Android Studio 2.1.2 i just get this messages "Error:Gradle 3.3 requires Java 7 or later to run. You are currently using Java 6."

I have install Java 7 and 8 in my mac. I have change the directory in Default Project Structure, but still that messages always appear and i can't do anything with the code.

Please master, help me.

Temen Nyantai
  • 81
  • 1
  • 1
  • 6

4 Answers4

2

Ran into the same issue, but I needed to keep java 6 for macOS legacy reasons (as I commented on Shubhendu's post). So I ended up downloading java 8 jdk found here

and on android studio 3.3 at least here is the rough path I took:

I right clicked project -> open module settings -> sdk location -> uncheck use embedded jdk -> added path to new 1.8 jdk which for me it was

/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home

adding java 8 idk to studio 3.3 project

Ryhan
  • 1,815
  • 1
  • 18
  • 22
1

Use this path in the Default Project Structure by using the browse option go up to this Directory named home.

/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home

May it works for you.

Shubham Sejpal
  • 3,556
  • 2
  • 14
  • 31
1

Deleting java 6 worked for me:

Run below command on your mac terminal:

sudo rm -rf /Library/Java/JavaVirtualMachines/1.6.0.jdk

enter image description here

ode2k
  • 2,653
  • 13
  • 20
  • what if you need java 6 for legacy reasons? certain macOS version sadly requires this.. – Ryhan Nov 15 '17 at 08:39
0

Ctrl-Alt-Shift-S to reach Project Structure window. Change Project SDK enter image description here

Akin Okegbile
  • 1,108
  • 19
  • 36