【问题标题】:ProGuard - unexpectedly contains classProGuard - 意外包含类
【发布时间】:2014-05-31 20:38:32
【问题描述】:

当我试图在 ProGuard 中混淆简单的 DataLoader.class 文件时,我收到了这个错误:

Reading program directory [C:\Users\uzytkownik\Documents\NetBeansProjects\ProTest\build\classes\Files\DataLoader.class]
Warning: class [DataLoader.class] unexpectedly contains class [Files.DataLoader]
Warning: there were 1 classes in incorrectly named files.
         You should make sure all file names correspond to their class names.
         The directory hierarchies must correspond to the package hierarchies.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
         If you don't mind the mentioned classes not being written out,
         you could try your luck using the '-ignorewarnings' option.
Please correct the above warnings first.

这是项目: http://www49.zippyshare.com/v/14668241/file.html

我会很感激你的帮助。

【问题讨论】:

    标签: class warnings obfuscation proguard


    【解决方案1】:
    Warning: class [META-INF/versions/9/module-info.class] unexpectedly contains class [module-info] 
    

    这是我遇到的问题,我尝试了下面提到的几个选项:

    1. -保留类模块信息
    2. -keepattributes 模块*
    3. -dontwarn 模块信息

    对我有用的选项是 3。

    不知道为什么,但它解决了我的问题,我可以制作罐子了。

    当您升级类似我升级 spring-boot 版本并且项目开始失败时会出现此问题。

    请同时检查 maven 依赖项。

    【讨论】:

    • 谢谢,第三个选项对我有用(不过要检查是否有副作用)。
    【解决方案2】:

    使用选项-injars-libraryjars,您应该指定类的正确基目录(或jar),就像类路径一样。在这种情况下:classes,而不是 classes\Files\DataLoader.class

    参见 ProGuard 手册 > 疑难解答 > Warning: class file ... unexpectedly contains class ...

    【讨论】:

    • 您能否提供一个-injars 的示例以及正确的基本目录和输入jar?查看文档时我没有找到任何示例
    猜你喜欢
    • 1970-01-01
    • 2015-05-08
    • 2011-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-10
    相关资源
    最近更新 更多