Verify apps resolved depenencies from a gradle plugin

Hi, I am developing a gradle plugin for android apps that integrate our library.
The idea is that our library needs some specific versions of some depenendencies that the host app can contain. If the versions dont match it can cause a lot of commotion.
To make it easier I decided to write a plugin that the app will apply that will check the apps resolved dependencies and detect if it contains those specific libraries and checks if the versions are ok. This plugin should run every time the app is being assembled.
I tried a lot of stuff and nothing works, currently I have:

override fun apply(target: Project) {
       target.task("CheckDependencies") {
           target.configurations.getByName("implementation").forEach {file ->
                 println("dep name = ${file.name}")
           }
       }
   }

This produces:

Resolving dependency configuration ‘implementation’ is not allowed as it is defined as ‘canBeResolved=false’.
Instead, a resolvable (‘canBeResolved=true’) dependency configuration that extends ‘implementation’ should be resolved.

how can I check the resolved dependencies versions inside a plugin task ?

As the error says, implementation is just a bucket for declaring a certain kind of dependencies, not for resolving them.
Use runtimeClasspath or compileClasspath, depending on what you want to check.

I get: > Configuration with name ‘runtimeClasspath’ not found.
or
Configuration with name ‘compileClasspath’ not found.

The java-base plugin adds all three of those configurations, so it shouldn’t happen that you have one but not the other two, unless you have some other plugin that adds implementation but not the others. But hard to say without an How to create a Minimal, Reproducible Example - Help Center - Stack Overflow or at least a build --scan.