Getting too many Proguard warnings

2019-05-31 06:33发布

I am trying to obfuscate my java application that is packed into a SINGEL jar. The application uses SWT gui libaries among others. I have duly listed them all in the Proguard configuration file via -libraryjars, but still I get too many warnings of the same type i.e.: "Warning: library class org.eclipse.swt.accessibility.Accessible$10 extends or implements program class org.eclipse.swt.internal.ole.win32.COMObject"

What am doing wrong here??

Here is how my Proguard configuration looks like:

-injars 'D:\Tasks\Deployment\NEW - 30.06.2011\proguard4.6\lib\fevflex.jar'
-outjars 'D:\Tasks\Deployment\NEW - 30.06.2011\proguard4.6\lib\fevflex_out.jar'

-libraryjars 'C:\Program Files\Java\jre6\lib\rt.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\resources.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\jsse.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\jce.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\charsets.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\ext\dnsns.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\ext\localedata.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\ext\sunjce_provider.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\ext\sunmscapi.jar'
-libraryjars 'C:\Program Files\Java\jre6\lib\ext\sunpkcs11.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\commons-collections-3.2.1.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\commons-io-2.0.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\mysql-connector-java-5.1.7-bin.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\org.eclipse.core.commands_3.4.0.I20080509-2000.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\org.eclipse.equinox.common_3.4.0.v20080421-2006.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\org.eclipse.jface_3.4.2.M20090107-0800.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\org.eclipse.nebula.widgets.grid-1.0.0-SNAPSHOT.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\org.swtchart_0.6.0.v20090801.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\swt.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\swt_64bit.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\swtgraphics2d.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\testng.jar'
-libraryjars 'D:\eclipse\workspace\main\Code\demo\lib\xom-1.2.6.jar'
-libraryjars 'D:\eclipse\eclipse\morelibs\c3p0-0.9.1.1.jar'
-libraryjars 'D:\eclipse\eclipse\morelibs\jboss-common-jdbc-wrapper.jar'
-libraryjars 'D:\eclipse\eclipse\morelibs\log4j-1.2.6.jar'
-libraryjars 'D:\eclipse\eclipse\morelibs\org.eclipse.swt.win32.win32.x86_3.3.0.v3346.jar'
-libraryjars 'D:\eclipse\eclipse\morelibs\xml-apis.jar'
-libraryjars 'D:\eclipse\eclipse\plugins\org.eclipse.osgi_3.6.1.R36x_v20100806.jar'
-libraryjars 'D:\eclipse\eclipse\plugins\org.eclipse.osgi.services_3.2.100.v20100503.jar'
-libraryjars 'D:\eclipse\eclipse\morelibs\eclipseAdaptor.jar'
-libraryjars 'D:\eclipse\eclipse\morelibs\org.eclipse.osgi_3.3.0.v20070530.jar'
-libraryjars 'D:\eclipse\eclipse\morelibs\xerces-2.2.1.jar'
-libraryjars 'D:\eclipse\eclipse\plugins\org.apache.commons.logging_1.0.4.v201005080501.jar'

-dontskipnonpubliclibraryclassmembers
-dontshrink
-dontoptimize
-dontusemixedcaseclassnames
-adaptresourcefilenames **.properties
-adaptresourcefilecontents **.properties,META-INF/MANIFEST.MF
-dontpreverify
-dontnote
-ignorewarnings
-printconfiguration 'D:\Tasks\Deployment\NEW - 30.06.2011\proguard4.6\lib\FLEX.pro'


-keep public class main.FEVFlex {
    public static void main(java.lang.String[]);
}

-keep class nu.** {
    <fields>;
    <methods>;
}

-keep class org.** {
    <fields>;
    <methods>;
}

-keep class com.** {
    <fields>;
    <methods>;
}

# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum  * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Keep names - Native method names. Keep all native class/method names.
-keepclasseswithmembers,allowshrinking class * {
    native <methods>;
}

标签: proguard
2条回答
何必那么认真
2楼-- · 2019-05-31 07:22

ProGuard manual > Troubleshooting > Warning: library class ... depends on program class ...

In this case, it looks like org.eclipse.swt.internal.ole.win32.COMObject is in your input jar fevflex.jar. You should remove it, or at least include it as part of a library jar.

查看更多
神经病院院长
3楼-- · 2019-05-31 07:31

I have noticed that you include both swt.jar and swt_64bit.jar in your libraries, while only one of these should be used at a time. Perhaps this is one of the reasons, why you are getting a lot of warnings.

查看更多
登录 后发表回答