问题
I want to distribute an SDK to end developers but I don’t want to share my code. I have used AAR file to share my SDK (Android Archive Library (aar) vs standard jar). But there is a possibility that others can view my class files. How to avoid that? Please help us.
Note: I had review this “Android - Need a way to create the library(.aar file) without source code” but it didn’t solve my problem.
回答1:
Proguard cuts unused classes. Libraries are standalone products, and has some specific entry points, which should not be obfsuscated. So you need to add rules to keep this entry points. Rules lookes like this:
-keep class packagename {public *;}
But, Proguard but will not encrypt strings.
Dexguard is a paid tool that includes string encryption and other features.
For a full comparison see this chart: https://www.saikoa.com/comparison-proguard-and-dexguard
来源:https://stackoverflow.com/questions/35360938/how-to-distribute-a-sdk-as-aar-file-without-exposing-the-source-code