Android ProGuard how to hide/obfuscate source code of exported library

。_饼干妹妹 提交于 2019-12-01 06:30:44

As you do not have a typical library, you should not include the typical library example.

First of all, you need to enable Proguard execution, change this line:

 minifyEnabled true

Second, you do not want to keep all public classes, but only the activity:

 -keep class LibraryActivityName { public protected <methods>; }

The remaining classes can be fully obfuscated if I understand your question correctly, so there should be no need for further configuration, unless you use reflection somewhere.

It would also be good if you repackage the obfuscated classes into an internal package or something using

 -repackageclasses my.library.package.internal

which might also required

 -allowaccessmodification

btw. ProGuard will not obfuscate the code itself, only the class / method names.

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