[Bug report] Unknown kotlin JVM target: 21 after adding photo manager
Version
3.3.0
Platforms
Android
Device Model
pixel 8
flutter info
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.26120.1930], locale en-US)
• Flutter version 3.24.3 on channel stable at C:\dev\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\Alex\AppData\Local\Android\sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
[√] VS Code (version 1.94.1)
• VS Code at C:\Users\Alex\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.98.0
[√] Connected device (4 available)
• Pixel 7 (mobile) • 29291FDH2003P7 • android-arm64 • Android 14 (API 34)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26120.1930]
• Chrome (web) • chrome • web-javascript • Google Chrome 129.0.6668.101
• Edge (web) • edge • web-javascript • Microsoft Edge 130.0.2849.27
[√] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
How to reproduce?
using android 35 with java 21 in the build options gives this error after adding photo_manager compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 }
kotlinOptions {
jvmTarget = "17"
}
Logs
[ ] FAILURE: Build failed with an exception.
[ +1 ms] * What went wrong:
[ ] Execution failed for task ':photo_manager:compileDebugKotlin'.
[ ] > Error while evaluating property 'compilerOptions.jvmTarget' of task ':photo_manager:compileDebugKotlin'.
[ ] > Failed to calculate the value of property 'jvmTarget'.
[ ] > Unknown Kotlin JVM target: 21
[ ] * Try:
[ ] > Run with --debug option to get more log output.
[ ] > Run with --scan to get full insights.
[ ] > Get more help at https://help.gradle.org.
[ +1 ms] * Exception is:
[ ] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':photo_manager:compileDebugKotlin'.
[ ] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
[ +36 ms] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
[ ] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
[ +1 ms] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
[ +1 ms] at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
[ ] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
[ ] at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)
[ ] at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:85)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
[ ] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:459)
[ ] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:376)
[ ] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[ ] at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
[ ] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[ ] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[ ] at java.base/java.lang.Thread.run(Unknown Source)
[ ] Caused by: org.gradle.api.internal.tasks.properties.PropertyEvaluationException: Error while evaluating property 'compilerOptions.jvmTarget' of task ':photo_manager:compileDebugKotlin'.
[ ] at org.gradle.api.internal.tasks.properties.InputParameterUtils.prepareInputParameterValue(InputParameterUtils.java:32)
[ ] at org.gradle.api.internal.tasks.execution.TaskExecution.lambda$visitRegularInputs$1(TaskExecution.java:317)
[ ] at org.gradle.internal.execution.impl.DefaultInputFingerprinter$InputCollectingVisitor.visitInputProperty(DefaultInputFingerprinter.java:103)
[ ] at org.gradle.api.internal.tasks.execution.TaskExecution.visitRegularInputs(TaskExecution.java:315)
[ ] at org.gradle.internal.execution.impl.DefaultInputFingerprinter.fingerprintInputProperties(DefaultInputFingerprinter.java:63)
[ ] at org.gradle.internal.execution.steps.AbstractCaptureStateBeforeExecutionStep.captureExecutionStateWithOutputs(AbstractCaptureStateBeforeExecutionStep.java:109)
[ ] at org.gradle.internal.execution.steps.AbstractCaptureStateBeforeExecutionStep.lambda$captureExecutionState$0(AbstractCaptureStateBeforeExecutionStep.java:74)
[ ] at org.gradle.internal.execution.steps.BuildOperationStep$1.call(BuildOperationStep.java:37)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
[ ] at org.gradle.internal.execution.steps.BuildOperationStep.operation(BuildOperationStep.java:34)
[ ] at org.gradle.internal.execution.steps.AbstractCaptureStateBeforeExecutionStep.captureExecutionState(AbstractCaptureStateBeforeExecutionStep.java:69)
[ ] at org.gradle.internal.execution.steps.AbstractCaptureStateBeforeExecutionStep.execute(AbstractCaptureStateBeforeExecutionStep.java:62)
[ ] at org.gradle.internal.execution.steps.AbstractCaptureStateBeforeExecutionStep.execute(AbstractCaptureStateBeforeExecutionStep.java:43)
[ ] at org.gradle.internal.execution.steps.AbstractSkipEmptyWorkStep.executeWithNonEmptySources(AbstractSkipEmptyWorkStep.java:125)
[ ] at org.gradle.internal.execution.steps.AbstractSkipEmptyWorkStep.execute(AbstractSkipEmptyWorkStep.java:61)
[ ] at org.gradle.internal.execution.steps.AbstractSkipEmptyWorkStep.execute(AbstractSkipEmptyWorkStep.java:36)
[ ] at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
[ ] at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:36)
[ ] at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:23)
[ ] at org.gradle.internal.execution.steps.HandleStaleOutputsStep.execute(HandleStaleOutputsStep.java:75)
[ ] at org.gradle.internal.execution.steps.HandleStaleOutputsStep.execute(HandleStaleOutputsStep.java:41)
[ ] at org.gradle.internal.execution.steps.AssignMutableWorkspaceStep.lambda$execute$0(AssignMutableWorkspaceStep.java:35)
[ ] at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:289)
[ ] at org.gradle.internal.execution.steps.AssignMutableWorkspaceStep.execute(AssignMutableWorkspaceStep.java:31)
[ ] at org.gradle.internal.execution.steps.AssignMutableWorkspaceStep.execute(AssignMutableWorkspaceStep.java:22)
[ ] at org.gradle.internal.execution.steps.ChoosePipelineStep.execute(ChoosePipelineStep.java:40)
[ ] at org.gradle.internal.execution.steps.ChoosePipelineStep.execute(ChoosePipelineStep.java:23)
[ ] at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.lambda$execute$2(ExecuteWorkBuildOperationFiringStep.java:67)
[ ] at java.base/java.util.Optional.orElseGet(Unknown Source)
[ ] at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.execute(ExecuteWorkBuildOperationFiringStep.java:67)
[ ] at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.execute(ExecuteWorkBuildOperationFiringStep.java:39)
[ ] at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:46)
[ ] at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:34)
[ ] at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:48)
[ ] at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:35)
[ ] at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:61)
[ ] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:127)
[ ] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:116)
[ ] at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
[ ] at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
[ ] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
[ ] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
[ ] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
[ ] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
[ ] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
[ ] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
[ ] at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
[ ] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
[ ] at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)
[ ] at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:85)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)
[ ] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
[ ] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:459)
[ ] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:376)
[ ] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[ ] at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
[ ] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[ ] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[ ] at java.base/java.lang.Thread.run(Unknown Source)
[ ] Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of property 'jvmTarget'.
[ ] at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:284)
[ ] at org.gradle.api.internal.provider.AbstractProperty.lambda$beforeRead$0(AbstractProperty.java:276)
[ ] at org.gradle.api.internal.provider.ValueState.finalizeOnReadIfNeeded(ValueState.java:139)
[ ] at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:276)
[ ] at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:268)
[ ] at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:162)
[ ] at org.gradle.api.internal.provider.AbstractMinimalProvider.getOrNull(AbstractMinimalProvider.java:105)
[ ] at org.gradle.api.internal.provider.ProviderResolutionStrategy$1.resolve(ProviderResolutionStrategy.java:27)
[ ] at org.gradle.util.internal.DeferredUtil.unpack(DeferredUtil.java:59)
[ ] at org.gradle.util.internal.DeferredUtil.unpackOrNull(DeferredUtil.java:49)
[ ] at org.gradle.api.internal.tasks.properties.InputParameterUtils.prepareInputParameterValue(InputParameterUtils.java:38)
[ ] at org.gradle.api.internal.tasks.properties.InputParameterUtils.prepareInputParameterValue(InputParameterUtils.java:30)
[ ] ... 73 more
[ ] 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)
[ ] at org.jetbrains.kotlin.gradle.tasks.DefaultKotlinJavaToolchain$sam$org_gradle_api_Transformer$0.transform(DefaultKotlinJavaToolchain.kt)
[ ] at org.gradle.api.internal.provider.ValueSupplier$Present.transform(ValueSupplier.java:518)
[ ] at org.gradle.api.internal.provider.TransformBackedProvider.mapValue(TransformBackedProvider.java:91)
[ ] at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:82)
[ ] at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:115)
[ ] at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:81)
[ ] at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:115)
[ ] at org.gradle.api.internal.provider.AbstractMinimalProvider.withFinalValue(AbstractMinimalProvider.java:168)
[ ] at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:162)
[ ] at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:33)
[ ] at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:281)
[ ] ... 84 more
[ ] BUILD FAILED in 7s
Example code (optional)
No response
Contact
No response
Any updates here, please?
Needs merge https://github.com/fluttercandies/flutter_photo_manager/pull/1203
Any updates here, please?
Yeah, sorry about delay, so figured out its most likely an issue with the vscode flutter extension and new project setup. It happens with several packages not just photo_manager. The solution for me for anyone who comes across this was to open just the android project folder in android studio directly and android studio will popup with the AGP upgrade wizard and upgrade AGP from 8.1.0 to 8.7.0 (I think that was the versions dont have it in front of me to check)
Any updates here, please?
Yeah, sorry about delay, so figured out its most likely an issue with the vscode flutter extension and new project setup. It happens with several packages not just photo_manager. The solution for me for anyone who comes across this was to open just the android project folder in android studio directly and android studio will popup with the AGP upgrade wizard and upgrade AGP from 8.1.0 to 8.7.0 (I think that was the versions dont have it in front of me to check)
I've upgraded, but have the same issue
I was having the same issue and after the following updates, the issue went away, might not work for everyone but I hope it helps some of you.
- android/settings.gradle (updated
pluginssection)
id "com.android.application" version "8.7.0" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
- android/gradle/wrapper/gradle-wrapper.properties (updated gradle to v8.9)
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
I was having the same issue and after the following updates, the issue went away, might not work for everyone but I hope it helps some of you.
- android/settings.gradle (updated
pluginssection)id "com.android.application" version "8.7.0" apply false id "org.jetbrains.kotlin.android" version "2.0.20" apply false
- android/gradle/wrapper/gradle-wrapper.properties (updated gradle to v8.9)
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
thanks,I followed your instructions, and it worked
For me, this issue occured because my kotlin version is too low after I upgraded to newer gradle & agp version. Find a matching kotlin version and this issue went away. ref https://docs.gradle.org/current/userguide/compatibility.html
Closing as the issue is not related to the plugin itself.
I was having the same issue and after the following updates, the issue went away, might not work for everyone but I hope it helps some of you.
* android/settings.gradle (updated `plugins` section)id "com.android.application" version "8.7.0" apply false id "org.jetbrains.kotlin.android" version "2.0.20" apply false* android/gradle/wrapper/gradle-wrapper.properties (updated gradle to v8.9)distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
It works for me, thanks.
I was having the same issue and after the following updates, the issue went away, might not work for everyone but I hope it helps some of you.
- android/settings.gradle (updated
pluginssection)id "com.android.application" version "8.7.0" apply false id "org.jetbrains.kotlin.android" version "2.0.20" apply false
- android/gradle/wrapper/gradle-wrapper.properties (updated gradle to v8.9)
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
Working for me
Android Studio may include a newer version of Java (JDK), that Android itself (especially older OS versions) doesn't support, so, the option shouldn't be used in this way.
compileOptions {
sourceCompatibility = <detected java from Android Studio>
targetCompatibility = <detected java from Android Studio>
}
It just breaks projects configured with older gradle, AGP, java, kotlin, but used with the newest Android Studio.
Flutter uses the bundled JDK in the Android Studio. Update through flutter config --jdk-dir if necessary.
@AlexV525 you are right, I used this workaround. But Java (JRE) used for building is not equal to java compile target for Android (same is for java source code compatibility). The plugin should not use the embedded version as a target java version for Android compiled binaries (class files. This is a bug.
I was having the same issue and after the following updates, the issue went away, might not work for everyone but I hope it helps some of you.
* android/settings.gradle (updated `plugins` section)id "com.android.application" version "8.7.0" apply false id "org.jetbrains.kotlin.android" version "2.0.20" apply false
* android/gradle/wrapper/gradle-wrapper.properties (updated gradle to v8.9)distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
tnx
I was having the same issue and after the following updates, the issue went away, might not work for everyone but I hope it helps some of you.
android/settings.gradle (updated
pluginssection)id "com.android.application" version "8.7.0" apply false id "org.jetbrains.kotlin.android" version "2.0.20" apply false
android/gradle/wrapper/gradle-wrapper.properties (updated gradle to v8.9)
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
I just change the "org.jetbrains.kotlin.android", and it works for me, thanks!.