title: Dagger error: Can't inject a non-static inner class
body: <p>I'm trying to implement dependency injection in my app using dagger. I have similar structure to described in <a href="http://corner.squareup.com/2014/01/mortar-and-flow.html" rel="nofollow">"Simpler Android apps with Flow and Mortar"</a></p>
  
  <p>I have a <code>DayScreen</code> class:</p>
  
  <pre><code>@Layout(R.layout.day)
  public class DayScreen extends DateScreen {
      LocalDate date;
  
      public DayScreen(LocalDate date) { this.date = date; }
  
      @Override public String getMortarScopeName() { return getClass.getName(); }
      @Override public Object getDaggerModule getModule() { retrun new Module(); }
  
  @dagger.Module(addsTo = UiModule.class, injects = DayView.class, complete = false, library = true)
  public class Module {
      @Inject RestService api;
      @Inject DateTimeFormatter formatter;
  
      @Provides @Named("DayScreenDate") LocalDate provideDate(){
          return date;
      }
  }
  
  @Singleton
  public class Presenter extends ViewPresenter&lt;DayView&gt; {
      //@Inject RestService api;
      //@Inject DateTimeFormatter formatter;
      RestService api;
      DateTimeFormatter formatter;
  
      @Inject Presenter( RestService api, DateTimeFormatter formatter){
          this.api = api;
          this.formatter = formatter;
      }
  
      @Override
      protected void onLoad(Bundle savedInstanceState) {
          super.onLoad(savedInstanceState);
          api.statisticsDay(DayScreen.this.date.format(formatter))
                  .observeOn(Schedulers.io())
                  .subscribeOn(AndroidSchedulers.mainThread())
                  .subscribe(
                          resp -&gt; getView().setData(resp.events),
                          err -&gt; Log.e(TAG, err.getLocalizedMessage()),
                          () -&gt; Log.v(TAG, "day stats received")
                  );
      }
  }
  </code></pre>
  
  <p>Here <code>DateScreen</code> is an abstract :</p>
  
  <pre><code>public abstract class DateScreen implements Blueprint {
    protected LocalDate date;
  
    public DateScreen() { this(LocalDate.now()); }
    public DateScreen(LocalDate date) { this.date = date; }
  
    public LocalDate getDate() { return date; }
    public void setDate(LocalDate date){ this.date = date; }
  }
  </code></pre>
  
  <p>I tried to inject <code>api</code> and <code>formatter</code> in Module and in Presenter through constructor and trough field injection but it cough the same error <code>error: Can't inject a non-static inner class:...</code></p>
  
  <p>Does anybody know why does it require static class ? Are there any changes that make article i mention above irrelevant ?</p>
  
  <p>Thanks. </p>