Michiyo
Michiyo

Reputation: 1201

Proguard: ignoring package does not prevent warnings

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.

Upvotes: 1

Views: 589

Answers (1)

T. Neidhart
T. Neidhart

Reputation: 6200

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.

Upvotes: 1

Related Questions