I am trying to migrate a project to Hilt but facing the below issue, not sure how to pass Context with Hilt. If I remove provideContext
method then it complains with the below error:
error: [Dagger/MissingBinding] @dagger.hilt.android.qualifiers.ApplicationContext android.content.Context cannot be provided without an @Provides-annotated method.
But my understanding is that in Hilt we don't need provideContext
method and we could just use @ApplicationContext
like below:
@Inject
public CardLayoutManager(@ApplicationContext Context context) {
mContext = context;
}
Am I missing something?