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

Java 21 and Gradle #12319

Open
2 tasks done
SeventhM opened this issue Oct 20, 2024 · 4 comments
Open
2 tasks done

Java 21 and Gradle #12319

SeventhM opened this issue Oct 20, 2024 · 4 comments
Labels
Toolchain Related to IDE, compilation, or other tools - not Unciv itself

Comments

@SeventhM
Copy link
Collaborator

SeventhM commented Oct 20, 2024

Before creating

  • This is NOT a gameplay feature from Civ VI, BNW, or outside - see Roadmap
  • This is NOT a gameplay feature from Vanilla Civ V or from G&K - If so, it should be a comment in Missing features from Civ V - G&K #4697

Problem Description

Currently, on some machines, if you do nothing except download Studio and download the code, you cannot build the code. You will instead get the following:

Your build is currently configured to use incompatible Java 21.0.3 and Gradle 8.2. Cannot sync the project.

We recommend upgrading to Gradle version 8.9.

The minimum compatible Gradle version is 8.5.

The maximum compatible Gradle JVM version is 19.

Possible solutions:
- Upgrade to Gradle 8.9 and re-sync
- Upgrade to Gradle 8.5 and re-sync

There's also the stack trace I can paste in, but I double much of it is useful since we probably should update gradle anyways

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':buildSrc:compileKotlin'.
Caused by: org.gradle.api.internal.tasks.properties.PropertyEvaluationException: Error while evaluating property 'compilerOptions.jvmTarget' of task ':buildSrc:compileKotlin'.
Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of property 'jvmTarget'.
Caused by: java.lang.IllegalArgumentException: Unknown Kotlin JVM target: 21
	at org.jetbrains.kotlin.gradle.dsl.JvmTarget$Companion.fromTarget(JvmTarget.kt:26)
	at org.jetbrains.kotlin.gradle.tasks.DefaultKotlinJavaToolchain$wireJvmTargetToToolchain$1$1.invoke(DefaultKotlinJavaToolchain.kt:78)
	at org.jetbrains.kotlin.gradle.tasks.DefaultKotlinJavaToolchain$wireJvmTargetToToolchain$1$1.invoke(DefaultKotlinJavaToolchain.kt:70)
        ...
@SeventhM SeventhM added the Toolchain Related to IDE, compilation, or other tools - not Unciv itself label Oct 20, 2024
@SeventhM
Copy link
Collaborator Author

SeventhM commented Oct 20, 2024

Interestingly, on this machine specifically, I'm also getting

org.gradle.jvm.toolchain.internal.NoToolchainAvailableException: Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=any vendor, implementation=vendor-specific} for WINDOWS on x86_64

Considering it's a brand new laptop, wouldn't be surprised if has something to do with windows 11 not actually shipping with java installed and Studio using only Java 21 as a backup

@itanasi
Copy link
Contributor

itanasi commented Oct 21, 2024

Personally going to just pull an archived version. I think Jellyfish used to work
https://developer.android.com/studio/archive

@itanasi
Copy link
Contributor

itanasi commented Oct 21, 2024

Seems Hedgehog, 2023.1.1 Patch 2, works. Supports the default AGP 8.2.2. Doesn't yell that Gradle is out of date and depreciated.
Had to flush the SDKs and JDK manually and reinstall.

@yairm210
Copy link
Owner

Updated in #12325

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Toolchain Related to IDE, compilation, or other tools - not Unciv itself
Projects
None yet
Development

No branches or pull requests

3 participants