title: Dagger 2 - error: @Provides methods cannot be static
body: <p>I've just added Dagger to my Android project. I've redesigned some of my classes to the Dependency Injection pattern and used the @Inject annotation on their constructors. I've also created corresponding modules and components. When I try to compile it, some of the @Provides methods from the modules give me this error:</p>
  
  <pre><code>error: @Provides methods cannot be static
  </code></pre>
  
  <p>All the methods that give me this error are @Singleton, static and have no parameters. I also have some @Provides methods that are @Singleton and static but have at least one parameter, and those don't give any errors.</p>
  
  <p>Does anyone know what is the cause of these errors? Dagger 2 should support static @Provides methods, according to the official User's Guide.</p>
  
  <pre><code>@Module
  public class DataModule {
  
  @Provides
  @Singleton
  static MessageDatabaseAdapter provideMessageDatabaseAdapter() { //this method gives error
      return new MessageDatabaseAdapter();
  }
  
  @Provides
  @Singleton //this method seems OK
  static MessageDataSource provideMessageDataSource(MessageDatabaseAdapter databaseAdapter) {
      return new MessageDataSource(databaseAdapter);
  }
  
  @Provides
  @Singleton
  static ContactsDataSource provideContactsDataSource() { //this method also gives error
      return new ContactsDataSource();
  }
  
  }
  </code></pre>