gpt4 book ai didi

java - Proguard 只保留类名以及类中的所有成员和方法

转载 作者:行者123 更新时间:2023-12-04 23:53:45 25 4
gpt4 key购买 nike

文档不够清楚,无法解释这一点。

-keepnames class_specification

Short for -keep,allowshrinking class_specification

Specifies classes and class members whose names are to be preserved, if they aren't removed in the shrinking phase. For example, you may want to keep all class names of classes that implement the Serializable interface, so that the processed code remains compatible with any originally serialized classes. Classes that aren't used at all can still be removed. Only applicable when obfuscating.

请任何人都可以解释一下keepnames属性。这将只保留类名或类的所有成员和方法。请提供一种方法来只保留类名而不是类的所有方法和成员。

抱歉英语不好。我以为我清楚地解释了我的问题。

最佳答案

请仔细阅读文档;它拥有完全理解所需的一切以及一点点反复试验。 :)

proguard documentation

顺便说一句,为了保留类名,将以下行添加到您的 progurard 文件中

-keepnames class your.package.name.ClassName {

}

示例:

-keepnames class com.example.test.domain.Person {

}

关于java - Proguard 只保留类名以及类中的所有成员和方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49383069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com