Closed praveeng145 closed 4 years ago
That sounds like a dagger misconfiguration:
The error message says you're injecting ApolloClient.Builder
somewhere without providing it.
err.. my bad I pasted the error when tried injecting ApolloClient.Builder
- but bottomline it I see the similar error injecting ApolloClient
as well.
I found that other classes in our codebase without public constructor gets injected successfully with @Provides
-annotated methods, except ApolloClient
. Not really sure what is wrong with the Dagger configuration.
Maybe try removing @Named("apolloGraphQlClient")
?
Yep.. already tried that. No luck. :(
I would suggest to close the issue since there is nothing to be fixed in Apollo side. Still, happy to investigate and help this issue if you provide more information.
With an initial look, I was also suspecting the @Named
annotation. If you use it, you need to use it in both places (@Provides and @Inject)
Also can you check if you use GraphQLModule
appropriately? Where do you put that?
Yes, I have setup GraphQLModule
correctly. I tried injecting a different class which is having a public constructor and it worked.
I tried removing @Named
altogether but it didn't worked.
I kept @Named
at both both places @Provides
and @Inject
but no luck.
Basically following the error message Dagger is unable to find the constructor that it can @Inject. However I have @Provides
-annotated method, but it still it is unable to pick it up.
I think I figured the problem - I "unintentionally" have a "protected" modifier before the apolloClient which caused the whole issue. Closing this issue.
Am unable to inject the ApolloClient object with Dagger2 even though I have the
@Provides
method. Here is my code snippet -I added the above @Module to my main
@Component
and @Inject in myFragment
This is the error message am getting -
[Updated the error message]
Am using the apollo-android version
1.2.2.
Am inject the ApolloClient as follows