Java11 VM’s for Android — Part 1: New Project

Java 8 was a long-awaited feature in the Android community. Finally, we got almost full support of language features. Unfortunately, newer versions of Java on Android remains just a dream.

Java updates are hard to adapt for Android, and this is one of the reasons why Google is promoting Kotlin as the Main language for application development. Despite disadvantages such as slow compilation times and slow code editing Kotlin getting more and more popular, especially in New Projects.

In this series of articles, I’ll try to demonstrate how we can finally make use of all new Java11 Virtual Machines to compile Android Projects with Kotlin.

Let’s begin

  1. Install your favorite Java 11 distribution, here is some list if you don’t know where to start:
    AdoptOpenJDK (HotSpot | OpenJ9)
    Zulu
    Amazon Coretto
    Oracle
  2. Check your java version by running “java -version” in terminal
  3. Create any new project in Android Studio 3.5+
  4. Build It

No matter what JVM you’ll choose compilation would be a success. So don’t be afraid to try some new VM’s on your project😉

Conclusion

Java 11 can be already used to compile some small sample projects. But there are still cases which will require a bit of effort to make it work:

Part 2: Annotation Processing

Let me know in the comments if you experienced any other problems compiling your Android Projects with Java11, and I’ll try to include an answer in one of my next articles😉

Staff Software Engineer @LyftLevel5 https://github.com/stepango | https://level5.lyft.com/

Staff Software Engineer @LyftLevel5 https://github.com/stepango | https://level5.lyft.com/