0

I'm working on an Android SDK that is about to be split into separate modules, with some code being shared between others, namely:

  • shared classes
  • SDK with feature #1
  • SDK with feature #2

There is a need of obfuscating the output AARs. With one single module it's not an issue, but I can't find how to configure the whole project correctly with Proguard.

How does the Proguard obfuscation work in case when I want to publish a new version of all these libraries? Will all the modules be obfuscated separately? How can I make sure that all the modules will be obfuscated at once and the release version of the libraries will correctly refer to all the artifacts that are located in the shared module?

mrpasqal
  • 1,000
  • 1
  • 6
  • 26

1 Answers1

0

Not sure I understand the issue.

But if you want to release 2 SDKs now instead of 1 (before split), I don't think the setup should differ very much.

Just make sure you have proguard file in these SDKs and you are using it in the build script specific to that SDK (module). Then just run something like :sdk:assembleRelease and you are done.

release {
    minifyEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'library.pro'
}

It is described in detail in this issue: Obfuscating the .aar files

I understand that shared module is not published, so there you just need to define specific proguard rules that will be used by other modules, like this:

 release {
      minifyEnabled true
      consumerProguardFiles 'onboarding-proguard-rules.pro'
 }
Martin Rajniak
  • 630
  • 8
  • 26