autonomousapps / autonomousapps/dependency-analysis-gradle-plugin

Using product flavors causes incorrect advice

Open
#1,654 4 comments 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.6.1

**Gradle version**
8.13 (also exists on 9.+)

**JDK version**
21.0.9

**Android Gradle Plugin (AGP) version**
8.13.2 (the same result on 9.0.1)

**`reason` output for bugs relating to incorrect advice**

[advice.txt](https://github.com/user-attachments/files/25796625/advice.txt)

**Describe the bug**
Running `./gradlew buildHealth` generates an advice that `googleImplementation(...)` should be replaced with `googleDebugImplementation(...)`, even though the code is used in both debug and release variants. Happens only in project containing product flavors.

- Package structure:
Image

- `build.gradle.kts`
Image

- Advice:

```
Advice for :app
Existing dependencies which should be modified to be as indicated:
googleDebugImplementation("com.google.android.play:review:2.0.2") (was googleImplementation)
```

That may be a coincidence but even though the generated advice are showing correct usage:

```
Source: googleDebug, main
-------------------------
* Imports 1 class: com.google.android.play.core.review.ReviewInfo (implies implementation).

Source: googleDebug, test
-------------------------
(no usages)

Source: googleRelease, main
---------------------------
* Imports 1 class: com.google.android.play.core.review.ReviewInfo (implies implementation).
```
I usually see that instead of combining `googleDebug` and `googleRelease` to `googleImplementation` it just takes whichever source value is shown first

**Additional context**
Project:

[DagpBug.zip](https://github.com/user-attachments/files/25797147/DagpBug.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached DagpBug.zip project and its build.gradle.kts, then run ./gradlew buildHealth and compare the result with advice.txt. Trace how googleDebug and googleRelease usages are combined; done means the advice reflects both variants rather than recommending an incorrect googleDebugImplementation replacement.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.