Java11 VM’s for Android — Part 2: Annotation Processors

As you could notice in my previous article, using Java 11 VM’s is pretty straight forward with sample apps. But what we should do when it does not work?

One of the possible setups where Java11 failed is Android Kotlin projects with KAPT and Dagger2. Let’s see how we can emulate this setup and fix it.

Extending our Sample App

Simple Dagger Component

Adding Component like this in your project — already causing an issue.

What happened here?

Well, Logs are clearly showing — Java is to blame. But the real problem here is KAPT.

Let’s see how we can deal with it, and there are 2 options here:

  1. Provide additional javac options for KAPT tasks

This way, we explicitly tell Dagger2 to generate output compatible with Java8.

2. Less hacky way — use the latest Kotlin EAP version, which is 1.3.60-eap-23.


Java11 VM’s are not an easiest thing to support in your Android projects. But it is still pretty much possible. In the next article, we’ll see how we can make this setup work with DataBindings.

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 |

Staff Software Engineer @LyftLevel5 |