user1679590
user1679590

Reputation: 41

Android library project - obfuscation

I'm preparing Android library for re-distribution and it's code must be obfuscated. I've read something about this topic and I've decided to use Android Library Project. It will be distributed as a jar (automatically created in /bin directory (I'm using eclipse with newest ADT). All the resources (layouts, drawables, etc.) will be distributed in separate package, which developer must add to his project manually (same as manifest permissions and so). So till now everything works - jar added to my clean project does what it should and it sees resources added to my base project. But the problem is when I want to obfuscate this library jar (the one generated automatically in Library project's /bin directory). Since Eclipse supports obfuscation with Proguard only in regular Android projects (when building APK), it doesn't provide obfuscation for Android Library Project (jar isn't obfuscated, even when line "proguard.config=proguard.cfg" is added to project.properties file). I think that the best way to obfuscate such a jar is to use Proguard outside from Eclipse then, but I don't know why I always get "empty output jar" - even when using parameters that I always used in my regular project, before I've decided to extract library from this. Tested with proguard 4.6, 4.7, 4.8 with the same effect. I would be grateful if anyone could show me example proguard.conf that will allow for obfuscation of android library project (e.g. basing on facebook Android Library Project that can be downloaded here: https://github.com/facebook/facebook-android-sdk/zipball/master). Every step-by-step instruction will be appreciated.

Thanks in advance!

Upvotes: 3

Views: 2381

Answers (1)

kaay
kaay

Reputation: 1103

"-dontshrink" will keep all classes. To be more selective, use the various "-keep" options.

Upvotes: 2

Related Questions