Building for Android
Panicz Maciej Godek
godek.maciek@gmail.com
Tue Oct 18 14:57:15 GMT 2022
Hi,
I've been trying to build a stub for GRASP running in the Android
environment.
My earlier prototype was written in Java, based on the scripts from a
github project called 'buildAPKs', that lets one build Android projects on
Android (using the Termux app).
Also, I found a github project that showd how to build apps written in Kawa
for Android, and even managed to build and run an example application:
https://github.com/abarbu/android-kawa
However, the caveat is that it comes with a kawa.jar file with version
1.13, which is quite old (and there are many features from the more recent
Kawa releases that GRASP relies on).
But when I try to build the KawaHello example using a kawa.jar built from
the most recent version, I get an error from the Android's ''dexer" tool
(which translates JVM bytecode to Dalvik/ART):
PARSE ERROR:
unsupported class file version 61.0
...while parsing gnu/bytecode/Access.class
So, what I suppose happens, is that the javac which builds Kawa emits byte
code that is unsupported by dx.
I tried building Kawa having passed --with-java-source=7 to the 'configure'
script, but that didn't help. I also tried cosplaying javac by ecj (which
is the compiler that the buildAPKs uses), but this results with a bunch of
warnings and some errors:
180. WARNING in
/data/data/com.termux/files/home/Kawa2/gnu/kawa/util/AbstractHashTable.java
(at line 243) static
class AbstractEntrySet<Entry extends Map.Entry<K,V>, K, V> extends
AbstractSet<Entry>
^^^^^ The type
parameter Entry is hiding the type Map.Entry<K,V>
----------
181. ERROR in
/data/data/com.termux/files/home/Kawa2/gnu/kawa/util/AbstractHashTable.java
(at line 287)
nextEntry = htable.table[nextIndex];
^^^^^^^^^^^^^^^^^^^^^^^ Type
mismatch: cannot convert from Map.Entry to Entry
----------
182. ERROR in
/data/data/com.termux/files/home/Kawa2/gnu/kawa/util/AbstractHashTable.java
(at line 298)
nextEntry = htable.getEntryNext(currentEntry);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type
mismatch: cannot convert from Map.Entry to Entry
----------
I'm not really sure where these errors stem from - I suppose ecj supports a
different subset of Java than the one that was used to write Kawa (I was
forcing source and tarfet
I also tried aliasing javac as javac -release 7, but it still seens to
produce the class file version 61.0.
Does anyone know how to produce a kawa.jar that would satisfy the dexer?
(The dexer version from the termux repo is 1.16)
More information about the Kawa
mailing list