autonomousapps / dependency-analysis-gradle-plugin

Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
Apache License 2.0
1.68k stars 114 forks source link

Dependencies used in Android Manifest are not recognized #1038

Open Vichy97 opened 7 months ago

Vichy97 commented 7 months ago

Plugin version 1.26.0

Describe the bug I have a theme used in an Android Manifest file that is provided by another module fixDependencies will strip this dependency as unused. android:theme="@style/Theme.MyTheme" In this example, MyTheme is provided by another module and is stripped. It's unclear if it is just not recognizing xml resources or if it isn't checking Android Manifest files specifically.

Expected behavior Modules that provide xml resources that are then used in AndroidManifest.xml will not be removed when running fixDependencies

autonomousapps commented 7 months ago

@Vichy97 DAGP does check the manifest file for resources that might be provided by other modules. It's possible it's missing the theme statement. Could you provide a minimal reproducer?

Vichy97 commented 7 months ago

🤔 I'm unable to repro this in a minimal project for some reason. It must be something specific about register. I'll try to repro there and provide a commit SHA.

SimonMarquis commented 4 months ago

@autonomousapps We are hitting the same issue when referencing a theme containing a period character (.) between two Android library modules.

Here is a PR demonstrating the repro of the issue: https://github.com/autonomousapps/dependency-analysis-gradle-plugin/pull/1146

Should I create a new issue stating the actual issue, or is this one good enough?

Also, I tried to check where this issue could be solved but I'm a bit stuck. I've added some details on the draft PR.

autonomousapps commented 4 months ago

@SimonMarquis no need for a new issue, this is sufficient. And thanks!