title: Dagger2 cannot access nullable. javax.annotation.Nullable not found
body: <p>I have a module to provide a Retrofit interface.</p>
  
  <pre><code>@Module
  class NetModule(val base: String) {
  
      @Provides
      @Singleton
      fun provideOkHttpClient(): OkHttpClient {
          return OkHttpClient.Builder()
                  .addInterceptor(object: Interceptor {
                      override fun intercept(chain: Interceptor.Chain): Response {
                          val request = chain.request()
                          info("Request for ${request.url()}")
                          return chain.proceed(request)
                      }
                  }).build()
      }
  
      @Provides
      @Singleton
      fun provideGson(): Gson {
          return GsonBuilder()
                  .enableComplexMapKeySerialization()
                  .serializeNulls()
                  .setPrettyPrinting()
                  .setLenient()
                  .create()
      }
  
      @Provides
      @Singleton
      fun provideRetrofit(OkHttpClient: OkHttpClient, Gson: Gson): Retrofit {
          return  Retrofit.Builder()
                  .baseUrl(base)
                  .client(OkHttpClient)
                  .addConverterFactory(GsonConverterFactory.create(Gson))
                  .addCallAdapterFactory(RxJava2CallAdapterFactory.createAsync())
                  .build()
  
      }
  
      @Provides
      @Singleton
      fun provideIdService(Retrofit: Retrofit): IdService {
          return Retrofit.create(IdService::class.java)
      }
  
  }
  </code></pre>
  
  <p>The <code>NetModule</code> is used with <code>NetComponent</code></p>
  
  <pre><code>@Singleton
  @Component(modules = arrayOf(NetModule::class))
  interface NetComponent {
  
      fun inject(application: Application)
  
      fun inject(activity: Activity)
  }
  </code></pre>
  
  <p>Which is injected in the application and stored in the applications companion object.</p>
  
  <pre><code>netComponent = DaggerNetComponent.builder().netModule(NetModule("some_url")).build()
  netComponent.inject(this)
  </code></pre>
  
  <p>In the Activity I then have</p>
  
  <pre><code>@Inject lateinit var idService: IdService
  </code></pre>
  
  <p>This gives a build error </p>
  
  <blockquote>
    <p><code>IdService</code> cannot be provided without an @Provides or @Produces annotated method.</p>
  </blockquote>
  
  <p>If I attempt to inject the <code>Retrofit</code> instance instead, I get a different error </p>
  
  <blockquote>
    <p>cannot access Nullable</p>
  </blockquote>
  
  <p>The stacktrace shows class file for javax.annotation.Nullable not found.</p>
  
  <p>I haven't been able to find anything referencing this error.
  There is a StackOverflow post from 12 hours ago which seems to have the same error, but it has been removed. 
  <a href="https://stackoverflow.com/questions/44983292/cannot-access-nullable-on-injecting-with-dagger2-in-kotlin">https://stackoverflow.com/questions/44983292/cannot-access-nullable-on-injecting-with-dagger2-in-kotlin</a></p>