dagger2 in android can't inject Fragment with

2019-08-01 02:31发布

问题:

on dagger2 home page, it suggest use the annotation @FragmentKey to inject Fragment. But this Fragment is under the package android.app , but we usually use the Fragment that was under the package android.support.v4.app, so, how to fix this?

回答1:

The dagger.android.support library is designed for this. See the user guide (under "Android" -> "Support Libraries"), the javadoc, and the code.



标签: dagger-2