1

Why does having proguard ignore a package not prevent the warnings related to that package?

Background:

I am attempting to apply proguard to a large project. Predictably, I have lots of warning like this:

Warning:net.fortuna.ical4j.model.CalendarFactory: can't find superclass or interface groovy.util.AbstractFactory
Warning:net.fortuna.ical4j.model.CalendarFactory: can't find superclass or interface groovy.lang.GroovyObject
Warning:net.fortuna.ical4j.model.ContentBuilder: can't find superclass or interface groovy.util.FactoryBuilderSupport
Warning:net.fortuna.ical4j.model.ParameterListFactory: can't find superclass or interface groovy.util.AbstractFactory
Warning:net.fortuna.ical4j.model.ParameterListFactory: can't find superclass or interface groovy.lang.GroovyObject
Warning:net.fortuna.ical4j.model.component.AbstractComponentFactory: can't find superclass or interface groovy.util.AbstractFactory
Warning:net.fortuna.ical4j.model.component.AbstractComponentFactory: can't find superclass or interface groovy.lang.GroovyObject
Warning:net.fortuna.ical4j.model.component.XComponentFactory: can't find superclass or interface groovy.util.AbstractFactory
Warning:net.fortuna.ical4j.model.component.XComponentFactory: can't find superclass or interface groovy.lang.GroovyObject
Warning:net.fortuna.ical4j.model.parameter.AbstractParameterFactory: can't find superclass or interface groovy.util.AbstractFactory
Warning:net.fortuna.ical4j.model.parameter.AbstractParameterFactory: can't find superclass or interface groovy.lang.GroovyObject
Warning:net.fortuna.ical4j.model.property.AbstractPropertyFactory: can't find superclass or interface groovy.util.AbstractFactory

I thought I could approach this by excluding these packages from proguard until my app runs with proguard enabled. Then, working package-by-package, I could figure out whether I should ignoring the warnings or exclude only the necessary pieces.

I used this example of how to exclude a package, adding

-keep class net.fortuna.ical4j.model.** { public protected private *; }

to my proguard rules file. However, I get the same warnings as before. I did find this which suggests using -keep in combination with -dontwarn, but I don't understand why having proguard ignore the package doesn't prevent the warnings all together.

Community
  • 1
  • 1
Michiyo
  • 1,161
  • 1
  • 14
  • 33

1 Answers1

1

Keeping a class will not automatically hide warnings related to this class as they might indicate problems with the configuration or missing inputs.

To hide warnings for a specific package use

-dontwarn com.example.**

This will only hide Warnings, but not Notes, which can be hidden like this:

-dontnote com.example.**

Looking at your specific warning messages, it looks like that you are missing a groovy library that is used and referenced by the ical4j model classes.

T. Neidhart
  • 6,060
  • 2
  • 15
  • 38
  • The groovy library is missing because proguard removed it? I thought it wouldn't remove things that were being directly used/referenced... – Michiyo Jun 16 '16 at 19:37
  • Proguard did not remove this library, the warning is issued when checking the configuration and input before doing any shrinking/obfuscation/optimization. – T. Neidhart Jun 16 '16 at 20:08