Dagger2 Error: Module Must Be Set : <p>I was trying to do SubScoping in Dagger2. However, I am not able to figure out this compilation error:-> <code>...MyApplicationModule must be set</code> which happens in my <code>LogInFragment</code>. If someone will try to throw some light on this error. I would really be glad.</p>

<p>This is <strong>MyApplication Class</strong>:</p>

<pre><code>public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        MyInjector.initialize(this);
    }
}
</code></pre>

<p>This is <strong>MyInjector Class:</strong></p>

<pre><code>public enum MyInjector {
    INSTANCE;

    MyApplicationComponent myApplicationComponent;


    private MyInjector() {
    }

    public static void initialize(MyApplication myApplication) {

        MyApplicationComponent myApplicationComponent = DaggerMyApplicationComponent.builder()
                .myApplicationModule(new MyApplicationModule(myApplication))
                .build();
        INSTANCE.myApplicationComponent = myApplicationComponent;
    }

    public static MyApplicationComponent get() {
        return INSTANCE.myApplicationComponent;
    }

}
</code></pre>

<p>This is <strong>MyApplicationComponent Class:</strong></p>

<pre><code>@Component (modules = {MyApplicationModule.class}) 
public interface MyApplicationComponent { 

}
</code></pre>

<p>This is <strong>MyApplicationModule Class</strong></p>

<pre><code>@Module
public class MyApplicationModule {

    private final MyApplication myApplication;

    public MyApplicationModule(MyApplication myApplication) {
        this.myApplication = myApplication;
    }

    @Singleton
    @Provides
    SharedPreferences providesSharedPreferences(Context context) {
        return context.getSharedPreferences("My_Pref", Context.MODE_PRIVATE);
    }

    @Singleton
    @Provides
    public Context providesMyApplicationContext() {
        return this.myApplication.getApplicationContext();
    }

    @Singleton
    @Provides
    public LocationManager providesLocationService(Context context) {
        return (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    }

    @Singleton
    @Provides
    public MyDatabaseManager providesMyDatabaseManager(Context context) {
        return MyDatabaseManager.getInstance(context);
    }

    @Singleton
    @Provides
    public AccountSystemModel providesAccountSystemModel(Context context) {
        return MyDatabaseManager.getInstance(context);
    }

    @Singleton
    @Provides
    public MyApplication providesMyApplication(){
        return this.myApplication;
    }

}
</code></pre>

<p>This is where I am trying to <strong>Subscope</strong> </p>

<p>This is <strong>MyLogIn Component Class</strong> </p>

<pre><code>@Singleton
@Component(modules = {MyApplicationModule.class}, dependencies = {MyApplicationComponent.class})
public interface LogInComponent {
    LogInPresenter signInPresenter();
}
</code></pre>

<p>This is where the <code>Compilation Error</code> happens</p>

<p>This is <strong>MyLogInActivityFragment</strong></p>

<pre><code>@Override protected void injectDependencies() {
   logInComponent = DaggerLogInComponent.builder()
                    .myApplicationComponent(MyInjector.get())
                    .build();
}
</code></pre>
