proguard hell - can't find referenced class

iasksillyquestions picture iasksillyquestions · Aug 7, 2011 · Viewed 72.6k times · Source

So, I'm TRYING to release some software but Proguard is giving me a headache.

When I try to export using proguard I'm getting lots of warning ie "can't find referenced class"

For example:

[2011-08-07 17:44:37 - GAME] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent
[2011-08-07 17:44:37 - GAME] Warning: there were 52 unresolved references to classes or interfaces.
[2011-08-07 17:44:37 - GAME]          You may need to specify additional library jars (using '-libraryjars'),
[2011-08-07 17:44:37 - GAME]          or perhaps the '-dontskipnonpubliclibraryclasses' option.
[2011-08-07 17:44:37 - GAME] java.io.IOException: Please correct the above warnings first.
[ 

The warnings seem to related to simpleframework, so in my proguard config file I've added the following:

-libraryjars pathtoprojecttolibs\simple-xml-2.4.jar

Where pathtoprojecttolibs is the path to jars which are referenced by my project.

This makes NO difference.

If simpleframework references javax can I tell proguard to ignore this too??

Any ideas?

Answer

Eric Lafortune picture Eric Lafortune · Aug 9, 2011

org.simpleframework.xml.stream.StreamReader in your code refers to javax.xml.stream.events.XMLEvent. The latter class is part of the Java runtime (rt.jar) but not part of the Android runtime (android.jar), so ProGuard warns that something might be broken. If you're sure that your application works anyway, you can specify

-dontwarn javax.xml.stream.events.**

ProGuard hell?