Debug transitive dependencies with Android Studio / IntelliJ

Hey there I have a problem, which i guess either i don’t understand correctly or is somehow an edge case.

I do have an App which depends on module1 which it self depends via ‘implementation’ on module2.
This is all fine and easy, it works as expected. My issue is that, if a stacktrace originates in module2 IntelliJ can’t show me the offending class in module2 nor can i set a breakpoint there. I guess since it is not in the default classpath, which is fine i dont want to allow anyone to access module2 implementations.

So I don’t want to change the visibility of module2 but I can only access/debug it if it is declared as ‘api’ dependency.

Is there a way, so that IntelliJ can resolve module2 but doesnt allow to access the classes from this module?

btw my current workaround is the following:

// my modules
[‘config’, ‘rest’, ‘auth’, ‘ui’].forEach {
implementation “group:prefix-${it}-dagger”

// use only for debug only…
[ ‘config’, ‘rest’, ‘auth’, ‘ui’].forEach {
implementation “group:prefix-${it}-impl”

but if I uncomment the second block, all implementations are also available for consumption, which is not what i want. I just want intelliJ to find and let me set breakpoints in the “-impl” modules.