0

When developing an android library, is it possible to hide internal classes so they're not available for the one who uses the library?

Suppose there is a module sdk. Let's suppose that someone develops an application and relies on the sdk.

sdk provides an interface (let's say X and it's implementation XImpl) and then has a lot of internal classes that are used to implement the XImpl.

How to hide the classes so the user of a library sees only X, XImpl (and possibly it's parameters)?

I distribute the sdk via a Gradle repository, so I can work with the modules a bit and extract that, but in the best case, I'd like to achieve that with some ProGuard configuration or similar.

2
  • Just set the visibility of your classes to something different than public. Commented Jun 28, 2018 at 11:58
  • Well, I'd like to leave the code as is and e.g. declare that package "internal" is not visible outside the library project. Moreover, if you declare classes e.g. protected, then you won't see them from outside the package. Commented Jun 28, 2018 at 12:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.