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

build(share_plus)!: Target Java 17 on Android #2730

Merged
merged 1 commit into from
Mar 19, 2024
Merged

Conversation

vbuberen
Copy link
Collaborator

Description

Same as #2723

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

@vbuberen vbuberen added the share_plus Feature, Enhancement, Bug Fixes for Share Plus Plugin label Mar 18, 2024
@vbuberen vbuberen merged commit e6853a0 into main Mar 19, 2024
17 of 19 checks passed
@vbuberen vbuberen deleted the update/share_java branch March 19, 2024 10:53
@orkun1675
Copy link

orkun1675 commented Mar 23, 2024

Since this PR I'm getting the following error when trying to build for Android:

Execution failed for task ':share_plus:compileReleaseKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (17) and 'compileReleaseKotlin' (1.8).

Could you explain what kind of migration is neccesary?

Do we need to upgrade to Gradle 8.4 even though it's in beta?

@vbuberen
Copy link
Collaborator Author

Could you explain what kind of migration is neccesary?

You need to change your build.gradle like it was changed in this PR to specify Java 17 to use during compilation of Kotlin code. From your error it looks like you have 1.8 specified in kotlinOptions section of your build.gradle file.

Do we need to upgrade to Gradle 8.4 even though it's in beta?

You are confusing Android Gradle Plugin and Gradle itself. While Android Gradle Plugin 8.4 is indeed in beta, Gradle 8.4 itslef isn't in beta. We require Gradle wrapper version to be 8.4. Gradle wrapper is specified in files like this inside any project: https://github.com/fluttercommunity/plus_plugins/blob/main/packages/share_plus/share_plus/android/gradle/wrapper/gradle-wrapper.properties

@orkun1675
Copy link

orkun1675 commented Mar 23, 2024

Thanks Volodymyr.

I have updated to Java 17 and Gradle Wrapper 8.4. I have kept Gradle Plugin at 8.2.2 due to a bug with 8.3.

Unfortunately this only replaced ther error with:

Execution failed for task ':games_services:compileReleaseKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (1.8) and 'compileReleaseKotlin' (17).

I'm not sure why, since the game_services plugin does not specify a Java or Kotlin version? link

As a final result, based on this Stackoverflow post, I added kotlin.jvm.target.validation.mode = IGNORE to my gradle.properties file. This doesn't sound great. But did fix the build issue.

@vbuberen
Copy link
Collaborator Author

And what about Java compile options? Did you also change it to 17 like it is done in this PR?
Both Java compile and Kotlin compile tasks should have the same Java target version.

These 2 lines are the ones responsible for Java version for Java compile: https://github.com/fluttercommunity/plus_plugins/pull/2730/files#diff-2607f8958e631dcb7f1ce17b341b8520cde253d7cde36a0bafc64d98676f4270R33

@vbuberen
Copy link
Collaborator Author

What is game_services plugin? 🤔 Not sure I understood that line

@orkun1675
Copy link

Yes, I did replaced the compile options with Java 17 as well. Here is the full app/build.gradle file: https://pastebin.com/ZQMH5NLf

And the settings.gradle file is: https://pastebin.com/WeXLHTab

Sorry for the broken link for the game_services plugin. I've updated it above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
share_plus Feature, Enhancement, Bug Fixes for Share Plus Plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants