为什么在Proguard Obfuscation之后我找不到这些资源?

时间:2012-09-05 15:27:54

标签: java obfuscation

Proguard Obfuscation无法从jar中找到资源, 我得到以下错误

Caused by: java.lang.NoClassDefFoundError: Could not initialize class mypackege.MyClass

2 个答案:

答案 0 :(得分:1)

可以在Link

找到

<adaptresourcefilenames filter = "file_filter" />
    Rename the specified resource files, based on the obfuscated names of the corresponding class files.

<adaptresourcefilecontents filter = "file_filter" />
Update the contents of the specified resource files, based on the obfuscated names of the processed classes.

答案 1 :(得分:0)

目前我们必须定义不希望成为ofus的ofuscas类和方法,因为它们将从jar外部调用

蚂蚁的例子:

<taskdef resource="proguard/ant/task.properties"
         classpath="/usr/local/java/proguard/lib/proguard.jar" />
<proguard>
  -libraryjars ${java.home}/lib/rt.jar
  -injars      in.jar
  -outjars     out.jar

  -keepclasseswithmembers public class * {
      public static void main(java.lang.String[]);
  }
</proguard>

更多信息:http://proguard.sourceforge.net/index.html#manual/ant.html

此致