0

We have created a demand dynamic module, this module just have the functionality of printing the data through a thermal printer, it doesn't have any activity. We need to access the classes and functions of this on demand module in our base code. Is it possible? if yes how can we access the code of the dynamic module in our base app after installing the dynamic module.

2
  • What is a "dynamic module" for you? In Android Studio a Module is just a library which provides Classes and Resources and can be accessed as usual: packagename.class.inner_class.method Commented Apr 6, 2021 at 8:43
  • @emandt dynamic modules are very different than adding a library. That's true that they are a library at the end of the day but this library is loaded and added to the codebase on runtime, not on compile time. So you can not access the classes or resources using the method you mentioned Commented Oct 12, 2023 at 22:29

1 Answer 1

0

Code defined in on-demand module is not accessible from the main module, because it doesn't have on-demand module as a usual dependency. Although it is possible to access the code using reflection or dependency injection.

More info on the subject can be found here: https://medium.com/androiddevelopers/patterns-for-accessing-code-from-dynamic-feature-modules-7e5dca6f9123

Sign up to request clarification or add additional context in comments.

Comments

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.