Using Subcomponent instead of Componentdependencies ...

suggest change
@Component(modules = AppModule.class)
public interface AppComponent {
    void inject(App app);

    Context provideContext();
    Gson provideGson();

    MainActivityComponent mainActivityComponent(ActivityModule activityModule);

@Subcomponent(modules = ActivityModule.class)
public interface MainActivityComponent {
    void inject(MainActivity activity);

public class MainActivity extends AppCompatActivity {

    Gson mGson;

    protected void onCreate(Bundle savedInstanceState) {

                .mainActivityComponent(new ActivityModule(this)).inject(this);

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents