Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JVM_TARGET not being applied correctly #263

Open
luca992 opened this issue Mar 31, 2024 · 2 comments
Open

JVM_TARGET not being applied correctly #263

luca992 opened this issue Mar 31, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@luca992
Copy link
Contributor

luca992 commented Mar 31, 2024

I think JVM_TARGET=8 is not being applied correctly. Using this library in a project being compiled with less than jdk 17 fails with:

Exception in thread "main" java.lang.UnsupportedClassVersionError: cash/z/ecc/android/bip39/Mnemonics$MnemonicCode 
has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime 
only recognizes class file versions up to 55.0
@luca992 luca992 added the bug Something isn't working label Mar 31, 2024
@who-biz
Copy link

who-biz commented Apr 29, 2024

Encountered this as well, when pulled in via Maven as a dependency of ZCash Wallet Android SDK.

Prevents compilation, with a less informative error message than above. Seems same issue, however.

Full error log:

ERROR:/home/xxxxxx/.gradle/caches/modules-2/files-2.1/cash.z.ecc.android/kotlin-bip39-jvm/1.0.6/87c564f7322b53c0ec2d8f6cc6b0de5d3cf2b737/bip39-lib-jvm.jar: D8: java.lang.IllegalArgumentException: Unsupported class file major version 61

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform bip39-lib-jvm.jar (cash.z.ecc.android:kotlin-bip39-jvm:1.0.6) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=27, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingNoClasspathTransform: /home/xxxxxxx/.gradle/caches/modules-2/files-2.1/cash.z.ecc.android/kotlin-bip39-jvm/1.0.6/87c564f7322b53c0ec2d8f6cc6b0de5d3cf2b737/bip39-lib-jvm.jar.
         > Error while dexing.

@who-biz
Copy link

who-biz commented May 10, 2024

Just adding some further information:

It looks as though setting JVM_TARGET in gradle.properties is improper.

Seems there are compiler options in build.gradle.kts that were missed, detailed here: https://kotlinlang.org/docs/gradle-compiler-options.html#for-all-kotlin-compilation-tasks

More specifically, jvmTarget needs set, in Kotlin compiler options:
image

More details here: https://stackoverflow.com/questions/41113268/how-to-set-up-kotlins-byte-code-version-in-gradle-project-to-java-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants