autonomousapps / autonomousapps/dependency-analysis-gradle-plugin

Redundant variant suggestion

Open
#1,695 1 comment 0 reactions 0 assignees View on GitHub
bug more information needed toolchain:android
Dominant language
Kotlin
Stars
2.2k
Forks
158
Avg merge
16h 25m
Merged PRs (30d)
46

Description

**Plugin version**
3.9.0

**(Optional) Android Gradle Plugin (AGP) version**
9.2.0

**(Optional) `reason` output for bugs relating to incorrect advice**
```
Source: variants1Debug, main
---------------------
* Exposes 1 class: com.airbnb.lottie.LottieAnimationView (implies api).

Source: variant1Release, main
-----------------------
* Exposes 1 class: com.airbnb.lottie.LottieAnimationView (implies api).
```

**Describe the bug**
Project with two build variants. The `variant1Api` dependency is ignored and suggested transitive dependencies `variant1DebugApi` and `variant1ReleaseApi`.

**To Reproduce**
Have android project with variants. Here is code of our convention plugin:
```
private fun CommonExtension.setProductFlavors() {
flavorDimensions.add("tenant")

productFlavors {
create("variant1") {
dimension = "tenant"
}
create("variant2") {
dimension = "tenant"
}
}
}

```

**Expected behavior**
No advice is giving

**Additional context**
Might be issue with AGP because when I run fixDependency and these suggestion is applied, I'm getting gradle script compilation:
```
Script compilation errors:

Line 104: variant1DebugApi(libs.lottie)
^ Unresolved reference 'variant1DebugApi'.

Line 117: variant1ReleaseApi(libs.lottie)
^ Unresolved reference 'variant1ReleaseApi'.
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with the shown Kotlin convention plugin, two Android product variants, plugin version 3.9.0, and AGP 9.2.0. Start from the reason output and the fixDependency path; done means variant1Api is respected, no redundant variant-specific advice is emitted, and applying the suggestions does not produce unresolved variant1DebugApi or variant1ReleaseApi references.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.