Danielle
Danielle

Reputation: 97

Keep class methods but obfuscate packages in proguard

com.company.package1.CLASS
- public void MethodA ();
- public void MethodB ();
- public void MethodC ();

The CLASS has 3 public methods and I need to keep them, but the package could be remove. I.e. the expected result could be

a.b.c.CLASS or a.b.c.D(alternative, the class name is obfuscated too)
- public void MethodA ();
- public void MethodB ();
- public void MethodC ();

I wrote some scripts but how to extends them in order to fulfill my requirement.

    -keep class 
        com.company.package1.CLASS {
        public <methods>;
    }

    -repackageclasses ''
    -allowaccessmodification

Upvotes: 1

Views: 3742

Answers (2)

panda
panda

Reputation: 466

use keep with allowobfuscation modifier, like below

-keep,allowobfuscation class xx

Upvotes: 5

Eric Lafortune
Eric Lafortune

Reputation: 45676

You can use -keepclassmembers instead of -keep -- cfr. ProGuard manual > Usage > Overview of -keep options.

Upvotes: 0

Related Questions