Hei! I’m getting issues with tests fixtures after ...
# kotlin-dsl
j
Hei! I’m getting issues with tests fixtures after migrating to kotlin 2.2.0
Could not determine the dependencies of task ‘ombordsalgcompileTestFixturesJava’.
> Resolving dependency configuration ‘testFixturesAnnotationProcessor’ is not allowed as it is defined as ‘canBeResolved=false’.
Instead, a resolvable (‘canBeResolved=true’) dependency configuration that extends ‘testFixturesAnnotationProcessor’ should be resolved.
Before 2.2.0 I had the experimental flag to true inside gradle.properties. After the migration, gradle complained that I had to remove it since it was not experimental anymore.
t
It's strange that an annotationProcessor configuration is not resolvable, as Gradle will create it that way (https://github.com/gradle/gradle/blob/7374493a8eab6b987c40342393cb905d279ec9a3/pla[…]a-base/src/main/java/org/gradle/api/plugins/JavaBasePlugin.java), so maybe it's created by another plugin in a different setup (Android?). Can you tell more about your configuration? (which version of Gradle, which plugins, in which version) That doesn't seem to be related to using the Kotlin DSL vs. the Groovy DSL to write your build scripts though (so wrong channel).
t
could you share a build scan with error?
j
./gradlew build --scan
fails with a completely unrelated error actually. The error in my first message comes when I run the unit tests of my project. If I run the app, I do not get any errors
t
which is kind-of expected as on running the app tests are not run and test fixtures are not required
Could you at least paste here full stacktrace with error?
j
For the versions I use: Gradle : 8.14.2 Plugins
Copy code
apollo = { id = "com.apollographql.apollo3", version.ref = "apollo" }
android-application = { id = "com.android.application", version.ref = "gradle" }
android-library = { id = "com.android.library", version.ref = "gradle" }
android-test = { id = "com.android.test", version.ref = "gradle" }
artifactory = { id = "com.jfrog.artifactory", version.ref = "artifactory" }
crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics" }
foojay = { id = "org.gradle.toolchains.foojay-resolver-convention", version.ref = "foojay" }
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
gradle-git-properties = { id = "com.gorylenko.gradle-git-properties", version.ref = "gradleGitProperties" }
java-ecosystem-capabilities = { id = "org.gradlex.java-ecosystem-capabilities", version.ref = "javaEcosystemCapabilities" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
openapi-generator = { id = "org.openapi.generator", version.ref = "openapi" }
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }
safeargs = { id = "androidx.navigation.safeargs.kotlin", version.ref = "androidxNavigation" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
firebase-perf = { id = "com.google.firebase.firebase-perf", version.ref =  "firebase-perf" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Full stack trace
t
Nothing comes to my mind. The best shot is to create a repro and share it here
j
I’m on holiday this evening hehe, I’ll try to create a repo with that error when I’m back. Thanks for the help anyway!
t
AFAICT, with AGP, the xxxAnnotationProcessor configurations are only for declaring dependencies, and the resolvable configurations are xxxAnnotationProcessorClasspath. But it should configure the JavaCompile tasks to use the correct one. Is there maybe some bad interaction with KSP? (I've found https://github.com/google/ksp/issues/2093, are you possibly working around that reconfiguring things and causing this error?)
j
I don’t think there’s anything special regarding the ksp configuration 🤔 I’ll check
Hi! I finally got time to create a fresh repo to reproduce the error but it works without any problem 🤔 So I have something in my original project that doesn’t cooperate
Untitled.txt
But I think I have a better stacktrace now somehow
t
Copy code
Caused by: java.lang.NoSuchMethodError: 'boolean org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.getUseK2()'
	at com.android.build.gradle.tasks.KotlinCompileCreationActionKt$applyJvmOptions$1.invoke(KotlinCompileCreationAction.kt:144)
	at com.android.build.gradle.tasks.KotlinCompileCreationActionKt$applyJvmOptions$1.invoke(KotlinCompileCreationAction.kt:134)
It looks like some KGP <-> AGP incompatibility caused by eager tasks realization
j
I found out what was the issue. The gradle dependency we had in our toml file wasn’t up to date. The issue got fixed by upgrading to the latest available version
👍 1