Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

In section, Subcomponents, Tutorial doesn't show, explicitly, removal of registration component injectors from AppComponent #52

Open
dgoldhirsch opened this issue May 28, 2021 · 1 comment

Comments

@dgoldhirsch
Copy link

This paragraph is stated (truthfully): In AppComponent, we have to remove the methods that can inject registration view classes because these won't be used anymore, those classes will use the RegistrationComponent.

But, it'd be helpful to the student to be told explicitly to remove these lines from AppComponent:

    fun inject(activity: RegistrationActivity)
    fun inject(fragment: EnterDetailsFragment)
    fun inject(fragment: TermsAndConditionsFragment)

Furthermore, it'd probably be helpful to add a gotcha warning in the next section of the tutorial ("Scoping Subcomponents"), warning them that if they failed to remove those injector calls from AppComponent they will get this error:

/Users/dg891e/repos/googlecodelabs/android-dagger/app/build/tmp/kapt3/stubs/debug/com/example/android/dagger/di/AppComponent.java:8: error: [Dagger/IncompatiblyScopedBindings] com.example.android.dagger.di.AppComponent scoped with @Singleton may not reference bindings with different scopes:
public abstract interface AppComponent {
                ^
      @com.example.android.dagger.di.ActivityScope class com.example.android.dagger.registration.RegistrationViewModel
@rickyManalo
Copy link

I was losing my mind because I can't see why I was getting that error. The codelab do need to make this changes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants