3

I'm trying to create a dex of the huge jar of the kotlin commandline compiler, so I can develop (i.e. compile) kotlin on a phone (in termux).

But dx runs out of RAM and is "Killed".

So, maybe divide into smaller dexs, and run as multidex? (also, close all other apps!)

Divide into dexs: fully extract the jar to files; separate with parallel directory structures; then apply dx to create one dex per root.

This worked, and I found dx could handle up to 13MB of classes, and I got the total 100MB of classes into 9 dexs.

Specify multiple dexs to dalvikvm - just like multiple jars with regular java. e.g.:

dalvikvm -cp sepdex_Main.dex:sepdex_Sep.dex sepdex.Main

NB: not /system/bin/dalvikvm, but termux's version, which fixes up the ld library path.

The next problem is that kotlinc uses dynamicInvoke, which requires sdk-level 26 (Android 8). I have Android 5.1, so the story ends here (for me).

hyperpallium
  • 571
  • 5
  • 18
  • Did you manage to do that? – KYHSGeekCode Oct 12 '18 at 08:43
  • @KYHSGeekCode No, still don't have an Android 8 dwvice. But (1) that's just what stopped me; maybe it needs further features (Oreo doesn't implement all of java 8); (2) a completely different approach is to install the java 8 JVM, and not use android's at all. I think there's a 3rd party repository for termux with it (and there *is* a 3rd party arch linux on termux, using `proot`, which might allow it), but I haven't tried either. Pls let me know if you get it working! – hyperpallium Oct 12 '18 at 11:18
  • 1
    @hyperpallium someone compiled OpenJDK 9 for Termux here: https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64 Both the JRE and JDK are available, and despite what the URL says, it's available for several architectures, not just x86_64. – beewall Apr 16 '19 at 17:41

0 Answers0