Skip to content

Dependency is both unused and is a transitive dependency to be declared #1730

Description

@pablobaxter

Build scan link
Should be declared as it's a transitive dependency: https://gradle.com/s/n7o2yjhm3t2hs
Should be removed as it's unused: https://gradle.com/s/bvc3nlb376bha

Plugin version
3.15.1-SNAPSHOT

Gradle version
9.5.0

JDK version
Launcher JVM: 21.0.11 (Eclipse Adoptium 21.0.11+10-LTS)
Daemon JVM: Compatible with Java 24, Oracle, nativeImageCapable=false (from gradle/gradle-daemon-jvm.properties)

(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version
2.4.0

(Optional) Android Gradle Plugin (AGP) version
9.3.0-alpha10

(Optional) reason output for bugs relating to incorrect advice
Reason for it being unused:

Isolated Projects is an incubating feature.
Calculating task graph as no cached configuration is available for tasks: :login:impl:reason --id libs.androidx.core.ktx

> Configure project :
The Dependency Analysis plugin is only known to work with versions of AGP between 8.10.0 and 9.1.0. You are using 9.3.0-alpha10. Proceed at your own risk.
Versions: [ Gradle: 9.5.0, AGP: 9.3.0-alpha10, R8: 9.3.12-dev, Kotlin: 2.4.0, KSP: 2.3.9 ]

> Task :login:impl:reason

------------------------------------------------------------
You asked about the dependency 'androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx)'.
You have been advised to remove this dependency from 'implementation'.
------------------------------------------------------------

Shortest path from :login:impl to androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx) for debugCompileClasspath:
:login:impl
\--- androidx.core:core-ktx:1.19.0

Shortest path from :login:impl to androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx) for debugRuntimeClasspath:
:login:impl
\--- androidx.core:core-ktx:1.19.0

Shortest path from :login:impl to androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx) for debugUnitTestCompileClasspath:
:login:impl
\--- androidx.core:core-ktx:1.19.0

Shortest path from :login:impl to androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx) for debugUnitTestRuntimeClasspath:
:login:impl
\--- androidx.core:core-ktx:1.19.0

Shortest path from :login:impl to androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx) for debugAndroidTestCompileClasspath:
:login:impl
\--- androidx.core:core-ktx:1.19.0

Shortest path from :login:impl to androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx) for debugAndroidTestRuntimeClasspath:
:login:impl
\--- androidx.core:core-ktx:1.19.0

Shortest path from :login:impl to androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx) for releaseCompileClasspath:
:login:impl
\--- androidx.core:core-ktx:1.19.0

Shortest path from :login:impl to androidx.core:core-ktx:1.19.0 (libs.androidx.core.ktx) for releaseRuntimeClasspath:
:login:impl
\--- androidx.core:core-ktx:1.19.0

Source: debug, android_test
---------------------------
(no usages)

Source: debug, main
-------------------
(no usages)

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

Source: release, main
---------------------
(no usages)

Reason for it being transitive:

Isolated Projects is an incubating feature.
Calculating task graph as configuration cache cannot be reused because file 'login\impl\build.toml' has changed.

> Configure project :
The Dependency Analysis plugin is only known to work with versions of AGP between 8.10.0 and 9.1.0. You are using 9.3.0-alpha10. Proceed at your own risk.
Versions: [ Gradle: 9.5.0, AGP: 9.3.0-alpha10, R8: 9.3.12-dev, Kotlin: 2.4.0, KSP: 2.3.9 ]

> Task :login:impl:reason

------------------------------------------------------------
You asked about the dependency 'androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx)'.
You have been advised to add this dependency to 'implementation'.
------------------------------------------------------------

Shortest path from :login:impl to androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx) for debugCompileClasspath:
:login:impl
\--- androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0
      \--- androidx.lifecycle:lifecycle-viewmodel-compose-android:2.10.0
            \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.10.0
                  \--- androidx.lifecycle:lifecycle-viewmodel-savedstate-android:2.10.0
                        \--- androidx.core:core-ktx:1.2.0

There is no path from :login:impl to androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx) for debugRuntimeClasspath


Shortest path from :login:impl to androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx) for debugUnitTestCompileClasspath:
:login:impl
\--- androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0
      \--- androidx.lifecycle:lifecycle-viewmodel-compose-android:2.10.0
            \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.10.0
                  \--- androidx.lifecycle:lifecycle-viewmodel-savedstate-android:2.10.0
                        \--- androidx.core:core-ktx:1.2.0

There is no path from :login:impl to androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx) for debugUnitTestRuntimeClasspath


Shortest path from :login:impl to androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx) for debugAndroidTestCompileClasspath:
:login:impl
\--- androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0
      \--- androidx.lifecycle:lifecycle-viewmodel-compose-android:2.10.0
            \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.10.0
                  \--- androidx.lifecycle:lifecycle-viewmodel-savedstate-android:2.10.0
                        \--- androidx.core:core-ktx:1.2.0

There is no path from :login:impl to androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx) for debugAndroidTestRuntimeClasspath


Shortest path from :login:impl to androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx) for releaseCompileClasspath:
:login:impl
\--- androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0
      \--- androidx.lifecycle:lifecycle-viewmodel-compose-android:2.10.0
            \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.10.0
                  \--- androidx.lifecycle:lifecycle-viewmodel-savedstate-android:2.10.0
                        \--- androidx.core:core-ktx:1.2.0

There is no path from :login:impl to androidx.core:core-ktx:1.2.0 (libs.androidx.core.ktx) for releaseRuntimeClasspath


Source: debug, android_test
---------------------------
(no usages)

Source: debug, main
-------------------
* Imports 1 inline member: androidx.core.net.toUri (implies implementation).

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

Source: release, main
---------------------
* Imports 1 inline member: androidx.core.net.toUri (implies implementation).

Describe the bug
DAGP is giving conflicting advice on a specific library.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the following repo: https://github.com/pablobaxter/starrynight.git
  2. Checkout the following commit: b554b827c0b0436f6e4b129d6d77134c5f20fd3f
  3. Run ./gradlew buildHealth. Observe that the report is requesting implementation libs.androidx.core.ktx.
  4. In login/impl/build.toml, uncomment line 19 to bring in this dependency.
  5. Run ./gradlew buildHealth. Observe that the report is now requesting removing implementation libs.androidx.core.ktx.

Expected behavior
Less Schrödinger reports.

Additional context
You can pass in various versions of DAGP via Gradle properties by using com.frybits.dagp. Similar flags for AGP (com.frybits.agp.version) and KGP (com.frybits.kotlin.version).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions