I was trying to get Android Studio to use Java 1.7 on Mac OS X (Mountain Lion)
I went to File > Project Structure...
and then tried to add a JDK with the +
button and then selecting JDK
.
I navigated to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
and selected that, but nothing happens. (this is where Oracle's Java updater installed Java 7 automatically)
How do I use Java 1.7 with Android Studio?
A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects.
all the way to 1.7, also known as Java 7) usually contain improvements to both the JVM and the standard library, so the two usually need to run together, and are packaged together in the JRE. If you are running any Java program on your computer, you have a JRE installed. The JDK is the Java Development Kit.
As per the docs, JDK 17 isn't supported yet in Android Studio. Actually, JDK 11 was supported starting from version 4.2 which was released in April 2021.
Class libraryJava 8 source code that works in latest version of Android, can be made to work in older versions of Android.
For those wonder how you start the actual program Android Studio with Java 7: edit the plist located in /Applications/Android Studio.app/Contents/Info.plist
Change the xml key JVMVersion
which is 1.6*
to 1.7*
(Java 7) or 1.6+
(latest version)
I don't know if there are any problems by doing this so take it easy.
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