Menu

ProGuard with Simplericity Macify

Help
2016-07-24
2016-07-24
  • Danlo Ringess

    Danlo Ringess - 2016-07-24

    My program works fine with Macify without using ProGuard, but loses the OS X integration (e.g command-Q to quit) after I run ProGuard. ProGuard issues several warnings such as:

    [proguard] Note: org.simplericity.macify.eawt.DefaultApplication: can't find dynamically referenced class com.apple.cocoa.application.NSApplication

    No runtime errors or warnings, though, so not sure where to start debugging. I've added to the ProGuard profile:

    -keep public class org.simplericity.macify.
    -keep public interface org.simplericity.macify.

    But no joy. Any suggestions where to look?

     
  • Eric Lafortune

    Eric Lafortune - 2016-07-24

    The class org.simplericity.macify.eawt.DefaultApplication and its inner class ApplicationListenerInvocationHandler seem to perform some reflection (Class#getMethod) to find methods in application listeners and event classes. You then need to preserve the methods of the interfaces involved, with their original names:

    -keepclassmembers interface org.simplericity.macify.eawt.* {
        <methods>;
    }
    

    Does that help?

    Otherwise, are you specifying -dontwarn or -ignorewarnings to let ProGuard ignore some warnings about missing OS X classes? You should then solve the warnings instead, by specifying the OS X java libraries with -libraryjars.