Kotlin not work with Java 13

[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.50:kapt (kapt) on project: Compilation failure
[ERROR] Unknown JVM target version: 13
[ERROR] Supported versions: 1.6, 1.8, 9, 10, 11, 12

Please remove hard coding supported version numbers, because new Java not working

1 Like

As far as I know there is currently no reason to specify 13 as your target as Kotlin doesn’t make use of any JVM features newer than Java 8. This can be found in the 1.3.30 changelog:

newer versions don’t add any bytecode optimizations or features beyond the ones that exist in lower versions, but that is going to change in the future.

So for now it shouldn’t really matter much at all.

1 Like

Thanks. i set jvm-target to 12, but maven compiler always use 13.

Jvm-target is required, If remove it then getting next:

Error:(10, 5) Kotlin: Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper ‘-jvm-target’ option

1 Like

Yes, the default target is 1.6, and since you are using features that are only supported at 1.8 and higher, you should set the target accordingly.

That said, it is very likely that the Kotlin compiler will take advantage of JVM 9/10/11/12 features sometime in the near future, so since you are building with JDK 13 anyway, you might as well leave it at 12 (and update to 13 when this is supported).

Proguard (An obfuscator and bytecode optimizer) can be used.