Obfuscating Android Library Project source code with ProGuard

浪子不回头ぞ 提交于 2019-12-12 22:19:29

问题


I am developping an Android Library Project with Eclipse that I want to licentiate. To prevent my clients to easily reverse-engineer and read my code, I want to obfuscate the source code of my library. From the research I did, I found that ProGuard seems to be conciderated the best for my usage.

I've seen a post from Eric Lafortune (ProGuard's creator) that tells that library projects don't run ProGuard, and this is confusing me. Why would it work with Android Application Projects and not with Android Library Project? Maybe I am just misreading something...

I've read several posts and blogs (see this one) about how to create the ProGuard config file along with the Ant build configuration. But this will surely take me several hours to make it work, if I manage to make it work... Not mentionning the fact that those posts and blogs might be outdated.

So, I would like to know if what I want is possible and if I am going in the right direction.


回答1:


You can obfuscate your library, but you need to add all your public API as exceptions so Proguard won't touch it. It's a lot of work. Be prepared to test a lot.

Also, if you obfuscate your library, you'll usually want to either obfuscate its dependencies too, or add those dependencies to exceptions. In the former case, your customers won't be able to upgrade the dependencies without upgrading the entire library, in the latter the entire obfuscation will be weaker.

Of course even after you add everything, you may stumble on more problematic issues.



来源:https://stackoverflow.com/questions/23120565/obfuscating-android-library-project-source-code-with-proguard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!