How to use the dagger library in the android library project?

1 answer

I do not know what a library is, but I would suggest that most of the code does not contain classes with an uncontrolled life cycle (actions, services, fragments, etc.).

If true, just use constructors to pass your dependencies.

If this is not the case, you need to decide who is going to store knowledge about dependency graphs. The usual solution, which context is applicable to the value of the graph of objects, or he knows how to get it. Uncontrolled lifecycle classes usually have access to the context.

+1
source

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


All Articles