Why did gradlew :app:dependencyInsight fail?

That's because firebase-messaging is declared in the implementation configuration. compileClasspath should be used

Try :

gradlew :app:dependencyInsight --configuration compileClasspath --dependency firebase-messaging

edit : using compileClasspath won't work with Android as described here

Using gradle :app:dependencies to fetch all dependencies seems to be the cleaner way to get all the dependencies of firebase-messaging


Using dependencyInsight with compileClasspath works just fine on Android projects (unlike what the accepted answer seems to claim). You just need to prefix it with the full build variant name!

For example, use debugCompileClasspath or releaseCompileClasspath as the configuration param if your project only uses build types.

If product flavours are also in use, the form is flavorDebugCompileClasspath (insert your own flavour name).

A working example from my project (product flavour full, build type debug):

./gradlew app:dependencyInsight --configuration fullDebugCompileClasspath --dependency gson