在 Proguard Obfuscation 无法从 jar 中找到资源后,我收到以下错误
Caused by: java.lang.NoClassDefFoundError: Could not initialize class mypackege.MyClass
在 Proguard Obfuscation 无法从 jar 中找到资源后,我收到以下错误
Caused by: java.lang.NoClassDefFoundError: Could not initialize class mypackege.MyClass
可以在 链接上找到
<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.
目前我们必须定义不想被经常使用的 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
问候,