如何告诉ProGuard混淆的类名 [英] How to tell Proguard to obfuscate class names

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

问题描述

我想ProGuard的混淆类名。我在Proguard.cfg此行

I would like proguard to obfuscate classnames. I have this line in Proguard.cfg

-keepclasseswithmembers class * {
public static <fields>;
}

-keepnames class * implements java.io.Serializable
-keep public class com.google.**

和我注意到,什么是不混乱是类的名字。因此运行jdgui我见
COM /测试/ ABCD / ActualClass.java
公共类ActualClassName扩展活动等。

And I notice that what is not obfuscated is the class names. So running jdgui i see com/test/abcd/ActualClass.java public class ActualClassName extends Activity etc

而且我看到真正的回归方法的类名。像

moreover I see methods returning real classnames. like

 ActualClassname aa();

和进口之类的语句

 import com.abcd.ActualClassName

我要如何Proguard的混淆类名本身。它不只是我看到这个我的适配器没有被模糊处理活动。那么有混淆回事,但不是类名。

How do I get Proguard to obfuscate the classname itself. Its not just for Activities that I see this my Adapters are not being obfuscated. Well there is obfuscation going on but not class names.

以上是什么prevents从类名称的规则被混淆?

Is the rules above what prevents the class names from being obfuscated?

更新:我已经删除,因为上面的规则,并且不会从Android的扩展任何一个实用工具类没有被模糊处理。现在我想知道是否有正在保持样活性derivied类关于保持即将从班引用类的类名称的一些隐含规则?这些类名字没有被模糊处理有几个共同点:

Update: i have since removed the rules above and a Utility class that does not extend anything from Android is not being obfuscated. I'm now wondering if there is some implicit rule about keeping class names of classes that are referenced from classes that are being kept like Activity derivied classes? The classes whose names are not being obfuscated have a few things in common:

1)静态方法
2)其他类型的保持像那些活动或衍生序列进口。
3)具有与其他类的参数(其中一些方法可能需要被保持)。

1) Static methods 2) Import of other types which are kept like those deriving from activity or serializable. 3) They have methods with parameters of other classes (Some of which might need to be kept).

然而,有没有在那里,我特别要求,这些实用工具类应当予以保留。

However there is no where that I am specifically requesting that these utility classes should be kept.

推荐答案

有几类出现在code,这样才能保证保持相同的完全限定类名的 安卓才能够找到他们。如上一个例子都是活动类,它们在清单通过其全名作为一个字符串来定义。如果 ProGuard的是重命名类,然后将Android的无再也无法找到他们。

There are several class that appear in your code that must retain the same fully qualified class name in order for to be able to find them. One example as above are all Activity classes, as they are defined in the manifest by their full name as a String. If proguard were to rename the class then Android would no longer be able to find them.

典型的Proguard的配置将参照Proguard的配置在Android SDK,其中将包括像这样的一些重要的行:

The typical Proguard config will refer to the Proguard config in the Android SDK which will include several important lines like this one:

-keep public class * extends android.app.Activity

这篇关于如何告诉ProGuard混淆的类名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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