title: lateinit property dispatchingAndroidInjector has not been initialized
body: <p>I receive the above error <strong>"lateinit property dispatchingAndroidInjector has not been initialized "</strong> when I run my fragment in dagger2 . <br>
  The above error is triggered in my application class which is below <br></p>
  
  <p>KotlinTemplateApplication.kt</p>
  
  <pre><code>     class KotlinTemplateApplication:Application(), HasActivityInjector  {
          lateinit var retroComponent:RetroComponent
  
  @Inject
  lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector&lt;Activity&gt;
  
  companion object {
      @get:Synchronized
      lateinit var instance: KotlinTemplateApplication
       private set
  }
  
  override fun onCreate() {
      super.onCreate()
      instance = this
      retroComponent = DaggerRetroComponent.builder().retroModule(RetroModule(APIURL.BASE_URL)).build()
      //retroComponent.inject()
  
  }
  
  
  
     fun fetchRetroComponent():RetroComponent{
     return retroComponent
     }
  
  override fun activityInjector(): AndroidInjector&lt;Activity&gt; {
      return dispatchingAndroidInjector
  }
     }
  </code></pre>
  
  <p><br>
  My Fragment class is as below : <br>
  I called dagger related code in onAttach() method of fragment  : <br>
  <br>
  RetroDIFragment:</p>
  
  <pre><code>      class RetroDIFragment : Fragment() {
  // TODO: Rename and change types of parameters
  private var param1: String? = null
  private var param2: String? = null
  lateinit var retroDIListViewModel: RetroDIListViewModel
  lateinit var retroFitDIView: View
  @Inject
  lateinit var apiService: APIService
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      arguments?.let {
          param1 = it.getString(ARG_PARAM1)
          param2 = it.getString(ARG_PARAM2)
      }
      retroDIListViewModel = ViewModelProviders.of(activity!!).get(RetroDIListViewModel::class.java)
  }
  
  override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                            savedInstanceState: Bundle?): View? {
      // Inflate the layout for this fragment
      retroFitDIView =  inflater.inflate(R.layout.fragment_retro_di, container, false)
  
      return retroFitDIView
  }
  
  override fun onAttach(context: Context?) {
      super.onAttach(context)
      AndroidInjection.inject(activity)
      KotlinTemplateApplication.instance.fetchRetroComponent().inject(this@RetroDIFragment)
  
      retroDIListViewModel.fetchPostsFromWebSevice(apiService).observe(this,object : Observer&lt;List&lt;RetroModel&gt;&gt;{
          override fun onChanged(t: List&lt;RetroModel&gt;?) {
              for (i in t!!.indices)
                  println(t[i].id)
          }
  
      })
  }
  companion object {
      /**
       * Use this factory method to create a new instance of
       * this fragment using the provided parameters.
       *
       * @param param1 Parameter 1.
       * @param param2 Parameter 2.
       * @return A new instance of fragment RetroDIFragment.
       */
      // TODO: Rename and change types and number of parameters
      @JvmStatic
      fun newInstance(param1: String, param2: String) =
              RetroDIFragment().apply {
                  arguments = Bundle().apply {
                      putString(ARG_PARAM1, param1)
                      putString(ARG_PARAM2, param2)
                  }
              }
  }
      }
  </code></pre>
  
  <p><br>
  My component is as below :<br><br>
  RetroComponent : <br></p>
  
  <pre><code> @Singleton
  @Component(modules = arrayOf(RetroModule::class))
    interface RetroComponent {
      fun inject(retroDIFragment: RetroDIFragment)
     }
  </code></pre>
  
  <p><br>
  My Module is as below: <br><br></p>
  
  <pre><code> @Module
     public class RetroModule(var urlPath:String) {
  
  
  init{
      this.urlPath  = urlPath
  }
  
  @Singleton
  @Provides
  fun provideServiceAPI(retrofit: Retrofit):APIService{
      return retrofit.create(APIService::class.java)
  }
  
  @Singleton
  @Provides
  fun provideRetrofit():Retrofit{
      val retrofit = Retrofit.Builder()
              .baseUrl(urlPath)
              .addConverterFactory(ScalarsConverterFactory.create())
              .addConverterFactory(GsonConverterFactory.create())
              .client(providesOkHttpClientBuilder())
              .build()
      return  retrofit
  
  }
  
  
  private fun providesOkHttpClientBuilder(): OkHttpClient {
  
      val httpClient = OkHttpClient.Builder()
      return httpClient.readTimeout(1200, TimeUnit.SECONDS)
              .connectTimeout(1200, TimeUnit.SECONDS).build()
  
  }
  }
  </code></pre>
  
  <p><br> My Activity is as below <br></p>
  
  <pre><code>class RetroFitActivity : AppCompatActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_retro_fit)
      supportFragmentManager.beginTransaction().replace(R.id.container_retro_di, RetroDIFragment()).commit()
  }
     }
  </code></pre>
  
  <p><br>
  I included below code in my Gradle:</p>
  
  <pre><code> implementation 'com.google.dagger:dagger:2.19'
  implementation 'com.google.dagger:dagger-android:2.19'
  annotationProcessor 'com.google.dagger:dagger-android-processor:2.19'
  annotationProcessor 'com.google.dagger:dagger-compiler:2.19'
  kapt 'com.google.dagger:dagger-android-processor:2.19'
  kapt 'com.google.dagger:dagger-compiler:2.19'
  //moxy
  compile 'com.arello-mobile:moxy-app-compat:1.1.1'
  kapt 'com.arello-mobile:moxy-compiler:1.1.1'
  </code></pre>
  
  <p><br>
  <br><br>
  Can anyone help me in fixing this issue.</p>