-
Notifications
You must be signed in to change notification settings - Fork 80
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
Support JDK 17 #71
Comments
Any workaround for now? |
@jonasborggren yep, add this into your android/build.gradle
|
@SherpaMiguel @jonasborggren can you explain the steps you're taking to get this error, or even create a reproducible example? I'm using java 19.0.2, gradle 8.1.1, and running |
@matanshukry in settings.gradle, update "com.android.application" (Gradle) to 8.2.2 and "org.jetbrains.kotlin.android" to 1.9.22 This is my plugin configuration in settings.gradle:
Also followed this migration guide: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply Note that this problem is ocurring in some other Flutter plugins: fluttercandies/flutter_image_compress#270 |
@SherpaMiguel When inserting your EDIT: Figured it out The bottom of the build.gradle file in a default Flutter setup will end up looking like this: rootProject.buildDir = '../build'
subprojects {
afterEvaluate {
if (project.plugins.hasPlugin("com.android.application")
|| project.plugins.hasPlugin("com.android.library")) {
if (project.name == "flutter_google_places_sdk_android") {
project.android.compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
}
}
}
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
} |
The afterEvaluate script should be inside "subprojects", in the root of android/build.gradle. |
Does anybody know when this fix may be released? |
@TatsuUkraine I've updated the build.gradle and settings.gradle due to an upgrade as part of flutter, but as I wrote before it is working for me successfully. I'm using Gradle 8.1.1 , Java 19.0.2, and flutter 3.24.0. If it still fails for you - what are you running exactly? what version each component you have, and what is the error? |
So I was recently updating project to AGP 8.3.1, due to an r8 issue. Which forced me to switch to java17. I'm on flutter 3.22 still though. But I already migrated to a new Gradle config, which was announced in prev stable release Workaround described here #71 (comment) worked for me as a tmp solution. I also noticed referenced PR in this thread, which got merged, but it seems new version with this fix wasn't released yet |
The error I'm getting prior tmp fix was exactly the one described in the description of this ticket |
@TatsuUkraine As far as I can tell the temporary solution described here is part of users/your project not part of this plugin, so it shouldn't be related. Try to provide more details or even a reproducible repo/example so I can reproduce the error on my end, and hence fix any issues if there are any |
That PR is not a reproducible example; it doesn't even talk about the problem. Also it was already merged, so I don't even understand what's your point... |
@matanshukry sorry, didn't write full message ( I meant that this PR got merged, but these changes was never released. As part of this changes I can see that it switches plugin to use java 17 |
@TatsuUkraine oh ok that make sense. |
I can be wrong here, but as far as I understand in order to switch to AGP 8 all your third party deps, as well as the project, should target the same jvm version, and the tmp fix in this thread does it by forcing current package have the same java version configs |
I have so many third party deps, so I can assume some of them does switch back and forward between jvm versions during the build, which ends up with the fail due to race condition in the Gradle build 😅 so I did just easiest thing so far - override compile options to match my project compile options for Google maps package and it worked)) |
@TatsuUkraine Published to 0.1.9 . |
@matanshukry thank you, I will let you know if anything comes up |
Closing for now then, will re-open if needed |
@matanshukry looks good on my end, builds are passing without the tmp fix |
When using Gradle 8 (requires JDK 17):
Execution failed for task ':flutter_google_places_sdk_android: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
The text was updated successfully, but these errors were encountered: