processing-android
processing-android copied to clipboard
Support building Android libs with Java 11 targetting Java 8
Processing-core library build with Java 11 results in the following error when running sketches from the PDE:
java.lang.NoSuchMethodError: No virtual method rewind()Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer; or its super classes (declaration of 'java.nio.ByteBuffer' appears in /system/framework/core-oj.jar)
Apparently this is caused by the library being built against the wrong JRE (see this) although the top level gradle build file already sets source and target compatibility to 1.8.
Sounds like setting the source and target compatibility to 1.8 is not enough because of the following:
https://stackoverflow.com/questions/43102787/what-is-the-release-flag-in-the-java-9-compiler
And the release compiler flag can be set in the gradle build file as well:
https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
This should do it, but then the packages sun.security.pkcs.* used in the JarSigner are not recognized by the compile (https://github.com/processing/processing-android/issues/627)... so switching to Java 8 to build the library for the time being.
Added option to top-level build file in https://github.com/processing/processing-android/commit/de89d8871bdc5f66771ba750900391bffe2465b1, will leave commented out until full transition to Java 11 is completed.