How Duolingo Migrated its Android App to 100% Kotlin –

Across the last two years, Duolingo seamlessly migrated its Java Android app to 100% Kotlin. Among the main benefits this brought, developers improved their productivity and happiness while the Duolingo app became almost null pointer exception (NPE) free. InfoQ has spoken with Duolingo Android and web development leader Art Chaidarun to learn more about their experience.

Since Google made Kotlin its preferred language for Android development, JetBrains’ language has been attracting ever more developer interest thanks to its modern feature set. Duolingo, maker of a successful language-learning platform, made the decision to move to Kotlin for Android development in 2018 to improve productivity, stability, and developer happiness.

As Duolingo Android and web development leader Art Chaidarun explains, the transition to Kotlin started with each developer getting some Java code to port to Kotlin and assigning mentorship roles to more experienced Kotlin developers. Particularly noteworthy is the pull request workflow that Duolingo engineers defined to make the conversion to Kotlin as easily manageable as possible. Specifically, for each converted source file, developers were required to generate a pull request containing at least three commits: one containing the results of IntelliJ auto-conversion; a second commit containing the fixes to any compilation errors introduced by auto-conversion; a third commit with changes to make the code more idiomatic.

According to Chaidarun, converting to Kotlin reduced line count by around 30%, with peaks of 90%. Eventually, Duolingo app stability improved greatly and most NullPointerExceptions and IllegalArgumentExceptions come from third-party dependencies that do