Building for Android
Panicz Maciej Godek
godek.maciek@gmail.com
Tue Oct 18 18:25:43 GMT 2022
wt., 18 paź 2022, 17:25 użytkownik Per Bothner <per@bothner.com> napisał:
>
>
> On 10/18/22 07:57, Panicz Maciej Godek via Kawa wrote:
> > 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.
>
> Try specifying the --release to javac. This may be helpful:
>
> https://stackoverflow.com/questions/43102787/what-is-the-release-flag-in-the-java-9-compiler
>
> > I tried building Kawa having passed --with-java-source=7 to the
> 'configure'
> > script, but that didn't help.
>
> Yes, IIRC (if I recall correctly) that doesn't change teh options passed
> to javac.
>
> You can pass the --target option to the kawa command when compiling Scheme
> to class files,
> but that currently defaults to 52 (Java 8), which hopefuly dexer will
> handle.
>
> > I also tried aliasing javac as javac -release 7, but it still seens to
> > produce the class file version 61.0.
>
> Hm. That is weird. You can try an exlicit 'javac --target 8' (say).
>
It seems that aliasing doesn't work with make. So I did the same thing as I
did with ecj -- wrote a shell script under prioritized $PATH which invoked
javac with --release N flag.
For N=7, I got a compilation error:
RuntimeParameterAnnotationsAttr.java:81: error: incompatible types:
ArrayList<Object> cannot be converted to List<AnnotationEntry>
attr.parameterEntries.add(new ArrayList<>());
^
RuntimeParameterAnnotationsAttr.java:85: error: incompatible types:
ArrayList<Object> cannot be converted to List<AnnotationEntry>
attr.parameterEntries.add(new ArrayList<>());
^
RuntimeParameterAnnotationsAttr.java:110: error: incompatible types:
ArrayList<Object> cannot be converted to List<AnnotationEntry>
parameterEntries.add(new ArrayList<>());
^
Fortunately, for N=8 the process completes successfully, and dexer no
longer complains on the class file version.
However, the dexing process now seems to be taking forever (ie. over 5
minutes), and the only way it managed to terminate so far was either by
throwing out-of-memory exception, or by complaining that it is unable to
allocate sufficiently large memory block due to fragmentation.
I've been doing it on my phone, which has 6GB of RAM -- I'd thought that's
sufficient -- but I'll also try it on a larger machine (still, I find that
behavior surprising: the jar for kawa 1.13 has 2.2MB, whereas the latest
one - 2.9MB, so it doesn't seem that much larger - yet dexing the old
version takes about 30 seconds and doesn't blow anything up)
According to https://en.wikipedia.org/wiki/Java_version_history
> class file version 61.0 is Java 17.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
>
More information about the Kawa
mailing list