I am trying to inject GoogleSignIn but when building throws exception error: [Dagger/MissingBinding] com.google.android.gms.auth.api.signin.GoogleSignInClient cannot be provided without an @Inject constructor or an @Provides-annotated method .
this is my file
@Module
@InstallIn(ViewModelComponent::class)
object AppModule {
@Provides
@ViewModelScoped
fun providesGoogleSignInOptions(@ApplicationContext context: Context) =
GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(context.getString(R.string.web_client_id))
.requestEmail()
.build()
@Provides
@ViewModelScoped
fun providesGoogleSignInClient(gso: GoogleSignInOptions,@ApplicationContext context: Context) =
GoogleSignIn.getClient(context, gso)
}
I don’t know what happened or how to deal with it
I tried searching for something similar but couldn’t find it, it took me almost a day to find the problem but it didn’t seem to work.