Testing Valhalla for IntelliJ + Android Studio

Testing Valhalla for IntelliJ + Android Studio

Save yourself some time and don't do this. Its one of those side quests that makes you run up a mountain to look at wall, there's not even a view. And you still have to walk down the mountain after.


I had a Reddit conversation a few weeks back that argued against using the newest JDK for Android builds, and specifically that it wasn't possible to use it to run Android Studio with. I was skeptical that this was truly the case, so in the midst of various other adventures with JVM tooling I decided to give it a good shot.

Modifying studio.vmoptions didn't change anything about the Android Studio process. I started digging into the JBR JDK and found that is JetBrains' fork of OpenJDK with specific patches. They also only make releases for LTS JDK releases, which is kinda a bummer because I wanted to try out whether Valhalla (in JDK 23) was helpful in general for running Android Studio.

Eventually I came across this bit of documentation on how to select the JDK version Intellij will run under. Following the instructions is pretty easy, its just Help > Find Action > Choose Boot Java Runtime for the IDE

Selecting that option creates a prompt with a pretty big and undismissable warning about not attempting to do this without JetBrains customer support guidance. Guess we'll find out how much this change breaks things...

You have to really dig for the alternate JDK options that are not JBR.

Time to reboot Android Studio...

Reopening Android Studio and running builds I could find no discernable difference in my test projects. Perhaps there are other bigger projects where some JVM performance would be noticed. Hence why I said this journey is like running up a mountain only to look at a wall, no view, no profit. And then I noticed none of the Finder menus worked. The Help menu that contained the only known path to setting a custom JDK path was also inoperable. Uh, do we need a helicopter to get down?

I used some grep-fu and analyzed where java.home might be getting set within my Application Support directory. For Jetbrains Toolbox installed IDEs that path seems to be ~/Library/Application Support/Google/<YOUR SPECIFIC IDE>. Deleting the studio.jdk file and restarting Android Studio resulted in going back to the default bundled JBR.


Save yourself some time and don't do this. Hopefully JDK 24 gets a JBR release and we'll see some worthy improvements then.