Hello! :wave: I’m facing “implicit dependency” iss...
# gradle
e
Hello! 👋 I’m facing “implicit dependency” issues while migrating my app to Gradle 8. The
debug
variant is working fine, however, the signed ones are throwing this error:
Copy code
Reason: Task ':app:deobfuscationArtifactUploadTaskDev' uses this output of task ':app:writeDevAppMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
I tried following the documentation to make them explicit, but it seems like a rabbit hole where I need to add dozens of tasks manually, for each variant.
Copy code
tasks.withType(DeobfuscationArtifactUploadTask).configureEach {
    dependsOn("writeDevAppMetadata",
            "mergeDevAssets",
            "compileDevArtProfile",
            "processApplicationManifestDevForBundle",
            "compressDevAssets",
            "l8DexDesugarLibDev",
            "bundleDevResources",
            "mergeDevJniLibFolders",
            "mergeDevNativeLibs",
            "collectDevDependencies",
            "extractDevNativeSymbolTables",
            ...
    )
}
Copy code
Gradle Version - 8.2.1
Android Gradle Plugin - 8.0.2 or 8.1.0
Java version - 11 or 17
Has anyone else faced this issue? Thank you in advance!
v
These problems most often result from tasks having overlapping outputs which is bad in several ways, or by configuring paths instead of wiring task outputs to task inputs. Adding explicit task dependencies might work-around the problem but most often are not the appropriate solution and might leave you with other problems. What the correct solution is in your case I cannot tell though, as I'm not an Android developer
But actually, any explicit
dependsOn
that does not have a lifecycle task on the left-hand side is a code smell.
e
I agree. My understanding is that the Android Gradle Plugin itself should declare the dependencies explicitly. However, this is not happening in other projects with Gradle 8 here. I’m not sure if this might be a bad setup or a bug.
v
No, even the AGP should not declare explicit dependencies. It should wire task outputs to task inputs and make sure tasks do not have overlapping outputs.
Maybe if you can knit an MCVE that shows that it is not actually your build being the culprit, you could report an issue.
e
Found the solution: actually it was not an AGP issue, it was one of the Gradle Plugins we use. After upgrading to the latest version, everything is fine. Thanks for the help.
👌 1
428 Views