Proguard的设置不删除未使用的方法 [英] Proguard setting to not remove unused method
问题描述
求索为Android以下code结构:
Conside the following code structure for android:
package blah;
class A{
class B{
public void foo(String s){
}
}
}
我怎么能告诉ProGuard不要删除或混淆富。结果
foo是code未使用的功能在编译时而是在运行时从另一个code运行。
How can I tell proguard to not remove or obfuscate foo.
foo is unused function in code at compile time but is run at run-time from another code.
我曾尝试:
-keep class blah.A.B;
-keepclassmembers class blah.A.B {
public void foo(String s);
}
等。但没有从去除功能停止Proguard的。
我不想ProGuard的改变'富'的名字。 Proguard的可能会改变A类或B类,但不是函数名称'富'的名字。
有什么建议?
etc. but nothing stops Proguard from removing that function. I do not want proguard to change name of 'foo'. Proguard may change the name of class A or class B but not the function name 'foo'. Any suggestions?
推荐答案
差不多吧。在Java字节code,$字符内部类和外部类的名称分开(以避免包名歧义)。所以,仅保存方法:
Almost right. In java bytecode, the $ character separates the names of inner classes and their outer classes (to avoid ambiguities with package names). So, to keep just the method:
-keepclassmembers class blah.A$B {
public void foo(java.lang.String);
}
这篇关于Proguard的设置不删除未使用的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!