1

is there a way to have invokedynamic on older versions than sdk level 26 (i.e. Oreo, Android 8)? i.e. just install the later VM (ART) version.

Because it's a VM feature, wouldn't it be independent of, and separable from, all non-VM sdk level 26 features, and run on any version of android...?

PS this is to get the kotlin compiler running on android.

hyperpallium
  • 571
  • 5
  • 18
  • See: https://developer.android.com/studio/write/java8-support.html#supported_features – Morrison Chang Mar 23 '18 at 02:19
  • @MorrisonChang I guess you mean *Desugar currently doesn't support MethodHandle.invoke or MethodHandle.invokeExact. If your source code or one of your module dependencies use one of these methods you need to specify minSdkVersion 26 or higher.* i.e. No – hyperpallium Mar 23 '18 at 02:32
  • Correct. Were I to tackle what you are doing, I would try to get the code into NDK/C/C++ land if you wanted to run on platforms other than "Oreo" API 26 and up. – Morrison Chang Mar 23 '18 at 02:40
  • Unfortunately, it's for the kotlin compiler, which is written in java and kotlin. There's no way to run a recent ART on an older Android ver? Since a compiler is just files in and out, it wouldn't use other OS features... Actually, perhaps I could install another JVM? [BTW running everything in a terminal (termux`) on android, not a full standalone android app. – hyperpallium Mar 23 '18 at 03:54
  • This: https://github.com/termux/termux-packages/tree/master/packages is the list of off-the-shelf packages for Termux. If it isn't there and you want to install a different JVM or tool you would have to compile your own. One path may be to look at [Kotlin/Native](https://blog.jetbrains.com/kotlin/2017/04/kotlinnative-tech-preview-kotlin-without-a-vm/) which seems to do what you are trying to do. Take a [look](https://github.com/JetBrains/kotlin-native) and see if you can port it into Termux. – Morrison Chang Mar 23 '18 at 04:59
  • Unfortunately, this targets machine code, but compilation requires JDK8 on the host (e.g. it cross-compiles to iOS) - I want the compiler itself to run on android. Compiling the compiler itself is conceivable, but they stress it isn't feature-complete... (I think they'd boast about it being self-hosting if it was.) But I noticed kotlin/JS... running it in a JS VM (in Node?) might be possible. Maybe [Kotlin Node.JS compiler installer and wrapper](https://www.npmjs.com/package/kotlin-node). Um, "Kotlin Compiler requires Java 6 or higher installed", but maybe that's ok, because pre-invokedynamic. – hyperpallium Mar 23 '18 at 05:38

0 Answers0