Hey folks, I've hit a strange issue when upgrading...
# gradle
g
Hey folks, I've hit a strange issue when upgrading my Android project to Gradle 8. I haven't been able to find the root of the issue but somehow it seems like some gradle tasks are using different java versions than other.
Copy code
Execution failed for task ':core: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.
Like, even if I add a new toolchain
Copy code
jvmToolchain {
        (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of("11"))
    }
I still get
Copy code
'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 11)
Updating this seems to work, but I still need to keep the bytecode compatible with 1.8
Copy code
android {
compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
}
c
I got this issue and made the change you did + I updated some other value that was set to 1.8 to 17.
t
AGP only since 8.1 version properly supports toolchains: https://issuetracker.google.com/issues/260059413
👍 1
135 Views