sidlatau / flutter_email_sender

Allows send emails from flutter using native platform functionality.
Apache License 2.0
146 stars 81 forks source link

Add Java 1.8 compile options and Kotlin JVM target in build.gradle #99

Closed calcitem closed 10 months ago

calcitem commented 10 months ago

This commit introduces specific compile options for the Android build.

Both the source and target compatibility have been set to Java Version 1.8. Additionally, the Kotlin JVM target has been set to '1.8'.

These changes ensure that the project aligns with the necessary Java and Kotlin compatibility levels.

sidlatau commented 10 months ago

This commit introduces specific compile options for the Android build.

Both the source and target compatibility have been set to Java Version 1.8. Additionally, the Kotlin JVM target has been set to '1.8'.

These changes ensure that the project aligns with the necessary Java and Kotlin compatibility levels.

Hm, can you explain more why this change is needed? It works for me without these changes.Why 1.8 was chosen? I see flutter recomends Java 11: https://docs.flutter.dev/add-to-app/android/project-setup#java-11-requirement

calcitem commented 10 months ago

Hi,

The change proposed in the PR addresses a specific build error I've encountered with Flutter version 3.10+ and flutter_email_sender version 6.0.1. The error message details a mismatch in the JVM target compatibility between the Java and Kotlin compile tasks:

Execution failed for task ':flutter_email_sender:compileReleaseKotlin'.
'compileReleaseJavaWithJavac' task (current target is 1.8) and 'compileReleaseKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

The full error log can be found here.

The build process specifies that both the Java and Kotlin JVM target compatibility should be the same. I've chosen 1.8 as it complies with the current target for 'compileReleaseJavaWithJavac'. Though Flutter recommends Java 11, adhering to 1.8 in this instance ensures that both Java and Kotlin tasks align, resolving the build error.

If the project were to be upgraded to Java 11, both Java and Kotlin target compatibility would need to be adjusted accordingly to maintain consistency.

I hope this clarifies the necessity of the changes in the PR. Please, let me know if further explanation is needed.

sidlatau commented 10 months ago

@calcitem thanks for the explanation and thanks for the PR!