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

后端 未结 2 428
甜味超标
甜味超标 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.

    0 讨论(0)
  • 2021-01-14 05:48

    In "/build/outputs/mapping/release/" folder there are few files ("usage.txt", "seeds.txt", etc..) that contain the REASONS of why and which classes/variables/methods/etc.. are not-processed/not-shrinked/ot-obfuscated via ProGuard utilities.

    0 讨论(0)
提交回复
热议问题