在ProGuard的,如何preserve一组类“方法名? [英] In proguard, how to preserve a set of classes' method names?

查看:209
本文介绍了在ProGuard的,如何preserve一组类“方法名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ProGuard的混淆我的android应用。 Android应用包含了一些本地的code,这使得回调完全合格的Java方法。我需要不混淆这些类和它们的方法的名称。下面适当地保持的类名称,而不是方法名。

  -keep公共类com.me.dontobf。*
-keepnames公共类com.me.dontobf。*
 

解决方案

有关本地方法: ProGuard的手册>例子>处理本地方法

  -keepclasseswithmembernames类* {
    天然的LT;方法&gt ;;
}
 

在这种情况下,回调方法: ProGuard的手册>例子>处理回调方法

  -keep类mypackage.MyCallbackClass {
    无效myCallbackMethod(java.lang.String中);
}
 

或者,例如,如果所有的公有方法可能会回调方法:

  -keep类mypackage.MyCallbackClass {
    公共和LT;方法&gt ;;
}
 

您可能还需要保持发生在方法描述的任何程序类。

I am using proguard to obfuscate my android application. The android application contains some native code, which makes callbacks to fully qualified java methods. I need to not obfuscate these classes and the names of their methods. The below properly keeps the class names, but not the method names.

-keep public class com.me.dontobf.*
-keepnames public class com.me.dontobf.*

解决方案

For native methods: ProGuard manual > Examples > Processing native methods

-keepclasseswithmembernames class * {
    native <methods>;
}

In this case, for callback methods: ProGuard manual > Examples > Processing callback methods

-keep class mypackage.MyCallbackClass {
    void myCallbackMethod(java.lang.String);
}

Or e.g., if all public methods may be callback methods:

-keep class mypackage.MyCallbackClass {
    public <methods>;
}

You probably also need to keep any program classes that occur in the method descriptors.

这篇关于在ProGuard的,如何preserve一组类“方法名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆