2012-09-05 85 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

問候,