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
These two can be (and usually are) the same, but you can configure them individually. And on OSX in particular, they will often be different.
Project JDK
You can configure the JDK used for compiling your code in the Project Structure Dialog. This will be used to get a compiler to compile your code with. If you are building with compileSdkVersion 21
or later, you should use JDK 7 or JDK 8 here. You can also configure this path by editing the local.properties
file in your project.
IDE JDK: Android Studio 2.2+
NOTE:
As of Android Studio 2.2, the IDE comes bundled with a custom OpenJDK build which contains a bunch of additional fixes to make the IDE work better (such as improved font rendering). If you've configured the IDE to use a custom JDK in the past, you should consider removing those configurations now and try the embedded JDK.
IDE JDK: Older versions
On Mac OSX, the version of Java used to run the IDE is generally chosen for you automatically, and the choice is based on an entry in the Info.plist file in the IDE installation. Please note: Do not edit Info.plist to pick a different version. That will break not only the application signature, but also future patch updates to your installation. Instead, you can pick a different JDK by setting the $STUDIO_JDK
environment variable, as described in the IDE Configuration document.
On Mac OSX, the default version we are using to run the IDE (not to compile your code) is Java 6. This is primarily because the font rendering on Java 6 has full subpixel LCD antialiasing, whereas Java 7 and 8 does not.
Here's what some sample text looks like with Java 8:
And here's the IDE run with the same settings and Java 6 instead:
If you don't find the Java 6 version much more readable, you should use Java 8 instead, since it is more actively kept up to date. As described in the IDE Configuration document, you can run it like this:
$ open /Applications/Android Studio.app
(If you're curious about the difference: Java 6 performs rendering with Quartz, where in addition to slightly changing the colors, the fonts are rendered with subpixel LCD antialiasing. This might be the JDK bug tracking this: https://bugs.openjdk.java.net/browse/JDK-8023794).
Installing Java 6
If you double click on the Android Studio app bundle, Mac OSX should automatically pop up a dialog offering to install Java for you. If not, you can download it from this page:
Yosemite (Mac OSX 10.10) Issues
There are some reports about graphics glitches and other bugs specific to running Android Studio on Yosemite.
First, please make sure that you have the latest version of Java 6 installed; in some cases that has fixed the problems:
If not, try running a recent version of Java 7 or Java 8 instead by setting STUDIO_JDK
as described above. That is reported to have fixed the other problems (though you will get the font rendering shown for Java 8 above.)
Comments are closed.