Addev
Addev

Reputation: 32253

How to avoid proguard to modify the package structure when obfuscating

I have a android library project with the following structure:

- com.domain
------------.internal //internal classes of the library
------------.thirdPartyLib //3rd party library package renamed
------------.library.publicclasses //All the public classes of the library

The idea is to configure progrard to:

- Don't remove any unused classes (since it is a library)
- Obfuscate and optimize everything (including class and methods names) except the classes under **publicclasses** that should keep their names and public elements unchanged

Currently my proguard config is:

-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keep,allowobfuscation class com.domain.** {*;}
-keep class com.domain.library.publicclasses.** {public *;}
-keep class com.domain.library.publicclasses.Foo {public protected *;}

The result of this config is:

- com.domain.library.publicclasses //All the public classes of the library
- a.a.a  /// all the internal and thirdPartyLib classes

My problem is the a.a.a classes are colliding with other library obfuscated classes, so i'd like the final class structure too be

- com.domain.library
--------------------.publicclasses //All the public classes of the library
--------------------.a  /// all the internal and thirdPartyLib classes

Keeping the obfuscated classes under my domain so it can't collide.

How can I achieve this?

Upvotes: 1

Views: 469

Answers (0)

Related Questions