Menu Close

DexGuard: protecting Kotlin apps since 2016

DexGuard: protecting Kotlin apps since 2016

DexGuard has no trouble optimizing and protecting Kotlin code thanks to its clean integration in the Android ecosystem. DexGuard fully follows the Java bytecode specification and supports all current and even future JVM (Java Virtual Machine) languages.

JVM language family

 
Kotlin is a programming language that addresses common annoyances with Java, (including its verbosity and some tricky work regarding null values) while maintaining full interoperability. It is currently estimated that 30% of all Android development deploys Kotlin in at least some parts of their codebase. This naturally begs the question whether all your favorite IDEs, tools and mobile application protection solutions still function correctly when switching to the newer, shinier Kotlin language.

To understand what it means to ‘support Kotlin’, we need to understand what role it plays in our codebase and how it achieves interoperability. Kotlin code has its own syntax for source code and should be written in a file like MyClass.kt. This file is then compiled with the kotlinc compiler. The compiler transforms the Kotlin file into fully valid Java bytecode, which is indistinguishable from compiled Java source code.

There is a whole family of programming languages and Java compiler plugins that produce Java bytecode. Some examples are the languages Scala and Clojure, or the popular Android frameworks Dagger and Butterknife.

DexGuard supports all JVM languages

 
Our open source tool ProGuard already processes Java bytecode and DexGuard even processes Dalvik bytecode and native code. It transparently handles all of the developer’s source code, whether it is Java or Kotlin or anything else. This approach ensures that our clients never need to worry about language compatibility.

Ever since Google decided to officially support Kotlin, we’ve had our clients transition smoothly to Kotlin projects. The Kotlin sample included in the DexGuard distribution illustrates the straightforward integration process. Additionally, we’ve fine-tuned our configuration for commonly used Kotlin libraries to ensure the Android developer’s code is optimally obfuscated and optimized with each build.