3 ms·
So, as someone who only knows the basics of the android ecosystem, are you able to compile down to lower target versions and still use the Java 17 niceties? As
by ebiester 2y ago
So, as someone who only knows the basics of the android ecosystem, are you able to compile down to lower target versions and still use the Java 17 niceties?
As I understand it, most people were using Kotlin because the alternative was java 8, and the syntactic sugar made it worth migrating.
- grishka 2y agoYes. In one instance I used Java 17 in an app that ran on as low as Android 4.2, and it did work just fine on an actual Galaxy Nexus. My current app's minSdk is Android 6. Though there are caveats: you can't use records (because they extend the new class java.lang.Record that desugaring library doesn't contain) and sealed classes (presumably because they require extra checks by the class loader). edit: records actually work now, with compileSdk set to 35 edit2: and sealed classes now work too. I tested both on a Samsung Galaxy S9 running Android 10, but the decompiled code looks very much Java 6 compatible so it should run on anything