2012-09-05 81 views
0

Proguard的混淆之后无法从罐子找资源, 我获得以下错误为什么在Proguard混淆后不能找到这些资源?

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

的类中找到已经被混淆(改名)... – gontard

+0

是的,它做工精细,但是出现以上错误 – twid

+0

您能否提供更多详细信息:完整的堆栈跟踪,用例。 mypackege.MyClass类在混淆的jar中? – gontard

回答

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.

0

同时,我们必须定义ofuscas不希望被ofusquen因为他们会从外部调用的类和方法的那一刻罐子

示例蚂蚁:

<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

问候,