Why some package-private classes are not obfuscated by Proguard?

后端 未结 2 429
甜味超标
甜味超标 2021-01-14 05:14

Working with an Android project in Android Studio 3.2, having enabled Proguard and some specific rules, I\'m not able to figure out the following:

a specific package

2条回答
  •  时光说笑
    2021-01-14 05:47

    Are you working on an Android Library project? Probably YES.

    In order to achieve your purpose, I am afraid that you need to re-organise your packages into something like below:

    Public interfaces

    com.my.package.apiforusers
    

    Private/Internal implementations

    com.my.package.apiforusers.internal
    

    Then for your obfuscation rules, you can have it like below:

    -keep public class com.my.package.apiforusers.* { public *; }
    

    So that only the public classes/interfaces are kept and all those ones inside com.my.package.apiforusers.internal will be obfuscated.

提交回复
热议问题