Skip to content

Change advice cannot be from and to the same configuration (testImplementation in this case) #1473

@SimonMarquis

Description

@SimonMarquis

Plugin version
2.18.0 and 2.19.0 (latest)

Gradle version
8.14.2

JDK version
21

(Optional) Android Gradle Plugin (AGP) version
8.9.3

Describe the bug
The plugin does not correctly interpret the transformation and generates an invalid change:

require(fromConfiguration != toConfiguration) {
"Change advice cannot be from and to the same configuration ($fromConfiguration in this case)"
}

To Reproduce

I have this Android library module:

dependencies {
    testImplementation(testFixtures(projects.libraries.applicationConfiguration))
}

but the test class that uses the fixtures in located in the testDebug sourceSet.

Expected behavior
The advice generated should properly handle build variant, and propose this change

 dependencies {
-    testImplementation(testFixtures(projects.libraries.applicationConfiguration))
+    testDebugImplementation(testFixtures(projects.libraries.applicationConfiguration))
 }

Additional context
What is a bit concerning is that, even after making this change, DAGP still shows the same error Change advice cannot be from and to the same configuration (testImplementation in this case) while there is no testImplementation hardcoded in the build file. Although there might be other convention plugins that are adding dependencies, the log message does not help. It would be great to show the coordinates as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions