Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proguard keep class names?

Hello I am writing an Android app and I have set up Proguard to obfuscate my application. I however use a classloader to dynamically load different extensions to my application. The problem is that these don't load correctly if their names are changed. How do I keep Proguard from obfuscating specific class names?

like image 836
Nik Avatar asked Jun 10 '12 19:06

Nik


1 Answers

Use the -keepnames option in your proguard.cfg

Refer to the manual https://www.guardsquare.com/en/proguard/manual/usage#keepoptions:

-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.

like image 67
Zaid Daghestani Avatar answered Oct 08 '22 00:10

Zaid Daghestani