Android - how to add @hide annotation to my project

I am developing an SDK and I would like to use the @hide annotation for methods / classes that I don't want to see for a user who uses my SDK. (same as in Action - line 3898 )

I tried adding an @hide note, but I saw that nothing was happening. What do I need to do to use the @ hide / annotation or any other similar solution to encapsulate my inner SDK classes / methods.

+5
source share
1 answer

In the Android SDK, the @hide annotation is only used when building the version of the android.jar stub. At compilation, time characters are imported from this stub, and only non-hidden characters are available. At run time, in a device or emulator, characters are present in platform libraries and can be seen, for example, by reflection.

If your SDK consists only of a jar file or something similar, there really is no way to hide the characters in it.

+5
source

Source: https://habr.com/ru/post/1202065/


All Articles