Proguard Obfuscation doesnt work on activities?

半腔热情 提交于 2019-12-12 04:12:48

问题


i ran proguard on my project but it doesnt obfuscate my activity name. i have tried several rules and it is not working. i dont know what exactly it means for example the rule below:

-keep public class models.* {
  *;
}

and whats the difference between

-keepclassmembers class * {

}

and

-keepclasseswithmembers class * {

}

i am having difficulty on how these rules work. please help.


回答1:


During the build process, proguard checks the AndroidManifest and keeps all activity classes. This is needed for your app to run. You should not obfuscate classes which extend android.app.Activity.


See:

Why Proguard keeps Activity class in Android?

Why proguard processes AndroidManifest.xml


whats the difference between ... keepclassmembers and ... keepclasseswithmembers

According to the documentation:

-keepclassmembers

Specifies class members to be preserved, if their classes are preserved as well. For example, you may want to keep all serialization fields and methods of classes that implement the Serializable interface.

-keepclasseswithmembers

Specifies classes and class members to be preserved, on the condition that all of the specified class members are present. For example, you may want to keep all applications that have a main method, without having to list them explicitly.

See: http://proguard.sourceforge.net/manual/usage.html



来源:https://stackoverflow.com/questions/40811898/proguard-obfuscation-doesnt-work-on-activities

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!