title: Inject in Dagger returns null
body: <p>Been blocked on this for a number of days.</p>
  
  <p>For some reason my the 'application' member field in AndroidModule.java is null after injection.</p>
  
  <p>AndroidModule.java</p>
  
  <pre><code>@Module(
          library = true
  )
  public class AndroidModule {
  
      @Inject MittoApplication application;
  
      @Provides @Singleton
      SharedPreferences provideSharedPreferences() {
          return PreferenceManager.getDefaultSharedPreferences( application );
      }
  
  }
  </code></pre>
  
  <p>ApplicationModule.java</p>
  
  <pre><code>@Module(
          includes = { ApiModule.class, AndroidModule.class },
          library = true
  )
  public class ApplicationModule {
  
      private Application application;
      public ApplicationModule( Application application ) {
          this.application = application;
      }
  
      @Provides @Singleton
      Application providesApplication() {
          return application;
      }
  }
  </code></pre>
  
  <p>BaseActivity.java</p>
  
  <pre><code>public class BaseActivity extends AppCompatActivity {
  
      private ObjectGraph objectGraph;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          objectGraph = MittoApplication.getApplication(this).buildScopedObjectGraph(getModules());
          objectGraph.inject(this);
      }
  
      @Override
      protected void onDestroy() {
          objectGraph = null;
          super.onDestroy();
      }
  
      protected List&lt;Object&gt; getModules(  ) {
          return Arrays.&lt;Object&gt;asList(
          );
      }
  }
  </code></pre>
  
  <p>MittoApplication.java</p>
  
  <pre><code>public class MittoApplication extends Application {
  
      private static Context context;
      private ObjectGraph objectGraph;
  
      public void onCreate() {
          super.onCreate();
          MittoApplication.context = getApplicationContext();
          initializeObjectGraph();
      }
  
      public static MittoApplication getApplication( Context context ) {
          MittoApplication mittoApplication = (MittoApplication) context.getApplicationContext();
          return mittoApplication;
      }
  
      public ObjectGraph getObjectGraph() {
          return this.objectGraph;
      }
  
      public ObjectGraph buildObjectGraph( List&lt;Object&gt; modules ) {
          return ObjectGraph.create(modules.toArray() );
      }
  
      public ObjectGraph buildScopedObjectGraph( List&lt;Object&gt; modules ) {
          return objectGraph.plus(modules.toArray() );
      }
  
      private ObjectGraph buildInitialObjectGraph( List&lt;Object&gt; modules ) {
          return ObjectGraph.create( modules.toArray() );
      }
  
      private void initializeObjectGraph() {
          objectGraph = buildInitialObjectGraph( Arrays.&lt;Object&gt;asList( new ApplicationModule(this) ));
      }
  
      public static Context getContext() {
          return MittoApplication.context;
      }
  
  }
  </code></pre>
  
  <p>I've spend ages pondering over this, I've looked at countless examples and blog sites. Would love someone smarter then I to assist. </p>
  
  <p>Thanks for reading.</p>