pwall567 / json-kotlin-schema

Kotlin implementation of JSON Schema (Draft 07)
MIT License
90 stars 13 forks source link

Cannot use 0.28 with android #3

Closed enra64 closed 2 years ago

enra64 commented 3 years ago

When including 0.28 in android, we get the following error. It seems that the log-front dependency is using too new calls for API <26 for Android.

   > Failed to transform log-front-2.3.jar (net.pwall.log:log-front:2.3) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /home/arne/.gradle/caches/transforms-3/45fe60c99964aab24d2889666a5b2b26/transformed/jetified-log-front-2.3.jar.
         > Error while dexing.
ERROR:/home/arne/.gradle/caches/transforms-3/45fe60c99964aab24d2889666a5b2b26/transformed/jetified-log-front-2.3.jar: D8: com.android.tools.r8.internal.m1: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
pwall567 commented 3 years ago

That's very unfortunate. Thanks for pointing this out - the JavaDoc comments say that MethodHandle has been part of Java since 1.7, which was released in 2011!

I was hoping to reduce the overhead of reflection-based calls to the underlying logging mechanism, but the performance improvement would have been very slight in any case.

I'll revert the changes in log-front and build a new version of json-kotlin-schema with the updated library.

Expect a new release in a few days - sorry you've been inconvenienced by this.

enra64 commented 3 years ago

Hey, thanks for the rapid response!

Yah, that's a bit weird... Especially since I've set the android source compatibility to Java 11... But Android is weird like that.

You can find similar reports for objectbox and other libraries when you search for the error. It seems to stem from desugaring, which we've enabled for Java Instant support: https://github.com/realm/realm-java/issues/6300

Sorry that your library hit this problem.

On 28 September 2021 11:20:41 Peter Wall @.***> wrote:

That's very unfortunate. Thanks for pointing this out - the JavaDoc comments say that MethodHandle has been part of Java since 1.7, which was released in 2011!

I was hoping to reduce the overhead of reflection-based calls to the underlying logging mechanism, but the performance improvement would have been very slight in any case.

I'll revert the changes in log-front and build a new version of json-kotlin-schema with the updated library.

Expect a new release in a few days - sorry you've been inconvenienced by this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

pwall567 commented 3 years ago

OK, I've reverted the changes to log-front so that it no longer uses MethodHandle, and built a new version of json-kotlin-schema - version 0.29 - with the new library.

I hope Android is happy with this version - let me know if you have any problems.

pwall567 commented 2 years ago

I am going to close this issue on the assumption that the new version solves the problem.

Feel free to open a new issue if if you have any further problems.