autonomousapps / autonomousapps/dependency-analysis-gradle-plugin
KMP project : Could not determine the dependencies of task ':lib:findDeclaredProcsAndroidDebug'
- Dominant language
- Kotlin
- Stars
- 2.2k
- Forks
- 158
- Avg merge
- 16h 25m
- Merged PRs (30d)
- 46
Description
**Build scan link**
https://gradle.com/s/d3ltudokzjhie
**Plugin version**
`3.9.0`
**Gradle version**
`9.2.1`
**JDK version**
`openjdk 21.0.10`
**(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version**
`2.3.20`
**(Optional) Android Gradle Plugin (AGP) version**
`8.13.2`
**Describe the bug**
See attached project, this is a KMP project on AGP 8.x, `./gradlew :lib:projectHealth` fails with :
```
* What went wrong:
Could not determine the dependencies of task ':lib:findDeclaredProcsAndroidDebug'.
> Resolving dependency configuration 'annotationProcessor' is not allowed as it is defined as 'canBeResolved=false'.
Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'annotationProcessor' should be resolved.
```
[dagp-kmp-repro.zip](https://github.com/user-attachments/files/26953064/dagp-kmp-repro.zip)
Also see the potential workaround commented out in the lib's build (not sure it entirely work) :
```
// KmpProjectAnalyzer hardcodes annotationProcessorConfigurationName = "annotationProcessor",
// AGP's declarative (canBeResolved=false) bucket. Gradle 9 rejects resolving it.
// Flip the bucket to resolvable so DAGP can read its (empty) artifacts.
//configurations.matching { it.name == "annotationProcessor" }.configureEach {
// isCanBeResolved = true
//}
```
Contributor guide
Research direction
Start by running ./gradlew :lib:projectHealth in the attached dagp-kmp-repro.zip and inspect the lib build configuration and KmpProjectAnalyzer path involved in findDeclaredProcsAndroidDebug. Verify the behavior against the annotationProcessor configuration described in the report; done means the KMP project health task completes on the stated Gradle, JDK, Kotlin, and AGP versions without the resolution error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100