java - 目录层次结构必须与包层次结构相对应

标签 java proguard obfuscation bukkit

我在尝试混淆我的 Java 程序(用于 Minecraft 服务器的 spigot API 插件)时收到以下错误

Note: you're writing the processed class files to a directory [C:\Users\user\Desktop\OBFUSCATE\out].
      This will likely cause problems with obfuscated mixed-case class names.
      You should consider writing the output to a jar file, or otherwise
      specify '-dontusemixedcaseclassnames'.
Reading program jar [C:\Users\user\Desktop\OBFUSCATE\pvptimer.jar]
Reading library jar [C:\Program Files\Java\jdk1.8.0_211\jre\lib\rt.jar]
Reading library jar [C:\Users\user\Desktop\OBFUSCATE\paper-1613.jar]
Warning: class [META-INF/versions/9/com/destroystokyo/paperclip/Main.class] unexpectedly contains class [com.destroystokyo.paperclip.Main]
Note: duplicate definition of library class [com.destroystokyo.paperclip.Main]
Warning: class [META-INF/versions/9/com/destroystokyo/paperclip/Agent.class] unexpectedly contains class [com.destroystokyo.paperclip.Agent]
Note: duplicate definition of library class [com.destroystokyo.paperclip.Agent]
Reading library jar [C:\Users\user\Desktop\OBFUSCATE\patched_1.12.2.jar]
Note: duplicate definition of library class [org.json.simple.ItemList]
Note: duplicate definition of library class [org.json.simple.JSONArray]
Note: duplicate definition of library class [org.json.simple.JSONAware]
Note: duplicate definition of library class [org.json.simple.JSONObject]
Note: duplicate definition of library class [org.json.simple.JSONStreamAware]
Note: duplicate definition of library class [org.json.simple.JSONValue]
Note: duplicate definition of library class [org.json.simple.parser.ContainerFactory]
Note: duplicate definition of library class [org.json.simple.parser.ContentHandler]
Note: duplicate definition of library class [org.json.simple.parser.JSONParser]
Note: duplicate definition of library class [org.json.simple.parser.ParseException]
Note: duplicate definition of library class [org.json.simple.parser.Yylex]
Note: duplicate definition of library class [org.json.simple.parser.Yytoken]
Note: there were 14 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning: there were 2 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.

我只是不确定如何修复此错误。我查看并发现了一些声称能够解决此问题的在线教程,但没有效果。

如果有人遇到过这个问题并且能够解决它,请分享你的智慧!

编辑**:

选择框忽略有关可能错误输入的警告后,会进行混淆,但在加载插件时,我收到此错误:

image

最佳答案

这很可能是由于您要混淆的代码所依赖的库,或者项目中的其他代码依赖于您现在混淆的代码,但其引用指向未混淆的 jar 的方法名称。 如果那个飞过你的头,请告诉我,如果可以的话,我会尽力解释得更好一些。

一个小例子:

OldClass { //This class, has reference to LibClass.callMethod
   void oldMethod() { 
     LibClass.callMethod(); 
   }
}

LibClass {
   static void callMethod() { 
      //now if this gets obfuscated, 
      //and the above code is never renamed to this new obfuscated name
      // you will get errors like you are seeing (The method doesn't exist anymore)

   }
}

关于java - 目录层次结构必须与包层次结构相对应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56829098/

相关文章:

java - 优化 Java 代码片段

Android:Proguard 在搞乱我

javascript - Dean Edwards 的 php 加壳器未重命名 var 和 function

c# - 用于非窗口操作系统的单声道混淆器

java - 经常调用的方法的日志记录实践

java - 使用 Java 在 Android 模拟器上的两点之间绘图

java - 让 Struts 与 JSF 一起工作

java - ProGuard 混淆

Android Proguard Release导致不执行for-loop

syntax - 奥德斯基对 "bills !*&^%~ code!"是认真的吗?