I coded an application with Flutter, I want to get an output of the application in appbundle (aab) format. The 2 libraries I use cause the same error.
Execution failed for task ':agora_uikit:compileReleaseKotlin'.
Execution failed for task ':emoji_picker_flutter:compileReleaseKotlin'.
Both have the same description of the error message:
'compileReleaseJavaWithJavac' task (current target is 1.8) and 'compileReleaseKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.'
I checked my build.gradle file at project level and application level many times. I tried to solve the problem with ChatGPT for hours. The only suggestion he gave me was to change this part
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
I tried many different variations like following:
JavaVersion.VERSION_17
jvmTarget = '17'
JavaVersion.VERSION_11
jvmTarget = '11'
JavaVersion.VERSION_1_8
jvmTarget = '1.8'
Btw, my kotlin version: 1.9.0
I am grateful in advance for any help.
I think this problem is caused by a bug. I found a workaround.
Add the following command to your gradle.porperties file.
kotlin.jvm.target.validation.mode = IGNORE