尝试混淆我的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.
我只是不确定如何解决此错误。我查看并找到了几本声称可以解决此问题但无济于事的在线教程。
如果有人遇到此问题并能够解决它,请分享您的智慧!
编辑**:
选中框Ignore warnings about possibly erroneous input
之后,会进行混淆,但是在加载插件时,会出现此错误:
答案 0 :(得分:2)
这很可能是由于您混淆的代码所依赖的库,或者您项目中的其他代码取决于您现在混淆的代码,但是其引用指向未混淆的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)
}
}