I was trying to use Proguard (6.1.0beta1) but got
(Unsupported version number [55.0] (maximum 54.0, Java 10)))
Are there alternatives to ProGuard which can manage with Java 11?
ProGuard is a command-line tool that reduces app size by shrinking bytecode and obfuscates the names of classes, fields and methods. It's an ideal fit for developers working with Java or Kotlin who are primarily interested in an Android optimizer.
R8 differs from proguard in the following ways: R8 has higher Kotlin language support as compared to proguard. Proguard is mainly used by applications developed using Java. Usually, the R8 compiler is much faster than the proguard compiler.
R8 configuration files. R8 uses ProGuard rules files to modify its default behavior and better understand your app's structure, such as the classes that serve as entry points into your app's code.
As a follow-up for Karol Dowbecki's answer: ProGuard 6.1.0 beta2 (or newer) supports Java 10, 11 and 12. See #188 Support Java 11
Notice that you'll need to change the libaryjars
for Java 9 or newer due to the introduction of the module system. Here's the section of my Gradle Kotlin build script:
if (JavaVersion.current().isJava9Compatible) {
libraryjars(System.getProperty("java.home") + "/jmods")
} else {
libraryjars(System.getProperty("java.home") + "/lib/rt.jar")
}
Java 11 have introduced changes to the bytecode and class file format:
Because of above it's unlikely that you will find a working code obfuscator at the moment. Hopefully ProGuard will be updated soon (see #188 Support Java 11 planned for ProGuard 6.1).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With