I am currently working on Android library project. Currently we have pure dependency injection(without any Frameworks). However, we expand our library functionality: providing more modules, separating code into new modules, dynamic delivery and etc. This is why our current DI will not suit our needs. We would need to invest tons of resources into that.

I did not used Dagger2 in the beginning, because I thought that library should have few dependencies. I am comfortable with Dagger2, so it won't create any issues.

However, what I fear is various issues, which my occur while integrating our library.

I wanted to ask, if it is possible to get Android gradle, or any other issues, if application does not use Dagger2 and library does?

Will integration issues occur if both application and library, uses different versions of dagger2?

Will integration issues occur if application uses another DI framework, like Coin for instance?

Thanks for answers!

1 Answers

0
Saswata Das On

Yes, you can use Dagger 2 for library project.

Dagger 2 is basically used to resolve dependencies into independent modules for better unit testing and various other optimisations of the project both library or user app.

  • No, integration problems doesn't occur if you can handle you Dex files. Also you may try using your library's files (external libraries) to avoid such errors.

  • No, integration error should not occur if two different external modules are used. But on must ensure thay if any common external module is being used by both DIs, both DIs must have same version of external module or well Dex managed.