How to use dagger in a android library project

后端 未结 3 1046
梦如初夏
梦如初夏 2020-12-08 00:23

I\'m currently trying to add Dagger to my android projects. For the apps projects its easy and clear to me, how to build the ObjectGraph. But I dont quite know whats the bes

3条回答
  •  一个人的身影
    2020-12-08 00:55

    if you are giving this library to people and they dont know nothing about your scenario so you must write it in a way that your Dagger works perfectly without any help from user. (the easier to work with the better practice)

    i just wrote some library for you to show how to do it. i wrote the library in a way that you can even run it standalone and see the result in the messages tab. user of your library doesnt need to know nothing about dagger and does nothing he just uses the library and dagger will be configured:

    https://github.com/amirziaratii/libraryUsingDagger.git

    if this library is something you use it yourself and for your own project, the best practice is do it like in this project of my friend:

    https://github.com/mmirhoseini/trakt.tv

    all your questions are answered in these two projects. ask any question and ill answer in comment.

提交回复
热议问题