You must install Oracle JDK before installing Android Studio, so please don't start this step until you have completed Step 1 above. Download Android Studio from the following address: Android Studio Download Page.
Android Studio requires two different JDKs: The version of Java that the IDE itself runs with. The version of the JDK that it uses to get the Java compiler from.
Up to Android Studio 3.5 beta 2 one could use JDK11 for compiling project by configuring it in Project Structure -> SDK Location -> JDK Location. This way Android Studio is run under bundled JDK8 but Gradle is using selected JDK11. Starting from Android Studio 3.5 beta 3 this setup is no longer supported.
Setting the directory to:
/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home
in JDK settings solved my issue. I had the same problem getting started up. Hope this helps!
@megapoff answer is correct . But I face little difficulty to fix it . So here is the detail solution step-by-step
For Mac
In JDK location click on browse and go to /->Library->Java->JavaVirtualMachines->jdk1.7.0_60.jdk->Contents->Home
Note :- Its Not /System/Library
it's /Library
click Apply and OK .... Bingo ..... Build the project again .....
The other answers are very correct but I want to be more concise and clear. To prevent others from visiting this page multiple times unnecessarily.
Important* Old Path is /System/Library/Java... and New Path is /Library/Java... (Not under the System directory)
Replace old path: /System/Library/Java/JavaVirtualMachines/jdk1.6.0_0.jdk/Contents/Home
Set your new path: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
I haven't moved over to Android Studio, yet. I've used it for a few tests and really like it. Just haven't been able to switch over yet. I've had this sort of issue in Eclipse and that's obviously a different solution, but looking through one of my test projects, this appears to be how you go about it:
Open your project and go to File->Settings.
Under the Project Settings, expand Compiler and go to the Java Compiler option. You want to use javac and set the project bytecode version to 1.7.
Hopefully that'll do it.
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