whole error is this
“A build operation failed.
Could not create task ‘:sample:compileDebugAndroidTestJavaWithJavac’.
Could not create task ‘:sample:compileDebugAndroidTestJavaWithJavac’.
Failed to calculate the value of task ‘:sample:compileDebugAndroidTestJavaWithJavac’ property ‘javaCompiler’.
Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=11, vendor=any, implementation=vendor-specific} for WINDOWS on x86_64.
No locally installed toolchains match and toolchain download repositories have not been configured.”
And below is the gradle file code.
plugins {
id("org.jetbrains.dokka")
id("org.jetbrains.kotlin.android")
id("com.android.library")
id("org.jetbrains.kotlin.plugin.parcelize")
id("com.vanniktech.maven.publish")
id("app.cash.licensee")
id("app.cash.paparazzi")
}
licensee {
allow("Apache-2.0")
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
android {
namespace = "com.canhub.cropper"
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
}
buildFeatures {
viewBinding = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
}
dependencies {
implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.exifinterface)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinx.coroutines.core)
}
dependencies {
testImplementation(libs.androidx.fragment.testing)
testImplementation(libs.androidx.test.junit)
testImplementation(libs.junit)
testImplementation(libs.mock)
testImplementation(libs.robolectric)
}
// Workaround https://github.com/cashapp/paparazzi/issues/1231
plugins.withId("app.cash.paparazzi") {
// Defer until afterEvaluate so that testImplementation is created by Android plugin.
afterEvaluate {
dependencies.constraints {
add("testImplementation", "com.google.guava:guava") {
attributes {
attribute(
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
objects.named(TargetJvmEnvironment::class.java, TargetJvmEnvironment.STANDARD_JVM),
)
}
because(
"LayoutLib and sdk-common depend on Guava's -jre published variant." +
"See https://github.com/cashapp/paparazzi/issues/906.",
)
}
}
}
}
Well i tried changing gradel version and jdk version from setting and project structure.