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

[Android] Fix build errors by defining kotlin jvmTarget. #1003

Merged
merged 1 commit into from
Feb 23, 2025

Conversation

timbotimbo2
Copy link
Contributor

@timbotimbo2 timbotimbo2 commented Feb 23, 2025

Description

Add the following to the build.gradle of the plugin.

kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8
}

This is present in newly created Flutter projects, just using a different version.

Because this value isn't currently defined, this can cause issues where the build tries to use different values for the java version and kotlin jvm version.

This leads to errors like

#986

Execution failed for task ':flutter_unity_widget:compileDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

In #992 on the Unity 6000 branch this caused:

Execution failed for task ':flutter_unity_widget:compileDebugKotlin'.
> Error while evaluating property 'compilerOptions.jvmTarget' of task ':flutter_unity_widget:compileDebugKotlin'.
   > Failed to calculate the value of property 'jvmTarget'.
      > Unknown Kotlin JVM target: 21

For now I simply use the same java version s used previously.
This value will likely need to be updated in the future.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@timbotimbo timbotimbo self-requested a review February 23, 2025 21:39
@timbotimbo timbotimbo merged commit 3effa7c into juicycleff:master Feb 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants