Does proguard's gradle plugin merge dependency proguard configs?

I’m trying to cut out the fat of my rather gigantic, 1k+ line proguard config and I’m wondering whether or not Proguard’s gradle plugin handles the proguard configs from dependencies in my app.

So if my app depends on some external library through maven such as Gson or Protobuf, does Proguard grab those dependencies’ proguard configs and merge those with my own app’s configs? Or do I need to explicitly merge those configs into my own or copy-paste them into my repository?

I could’ve sworn that the Proguard plugin handled these sorts of transitive issues, but looking at our config it seems like most of them are concerned with dependency classes rather than our own app’s classes.

Hi @jywei,

ProGuard should automatically pick up the consumer rules which are part of the dependencies. You could verify this by adding -printconfiguration fullconfig.txt to your configuration file while having the copied -keep rules commented out. The consumer rules should appear in the fullconfig.txt document as this contains all configuration rules used by ProGuard.

You can use the ProGuard Playground to visualize the impact of these -keep rules on your project without continuously having to rebuild the project.

Best regards,


1 Like