title: org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException: Descriptor wasn't found for declaration SCRIPT
body: <p>I can’t build a project after trying to add a dagger</p>
  
  <p>I'm new to using kotlin
  I use a sample Dagger 2 project at some point my project stopped starting</p>
  
  <p><strong>Solution Tried:</strong></p>
  
  <p>Invalidate Caches/Restart
  Build -> Clean Project
  Update kotlin plugin, used lastest version of kotlin</p>
  
  <p><strong>build:gradle(Module:app)</strong></p>
  
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-android-extensions'
  apply plugin: 'kotlin-kapt'
  
  android {
      compileSdkVersion 29
      buildToolsVersion "29.0.2"
      defaultConfig {
          applicationId "com.example.app"
          minSdkVersion 21
          targetSdkVersion 29
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  
      kotlinOptions {
          jvmTarget = '1.8'
  
      }
  
      dataBinding {
          enabled = true
          enabledForTests = true
      }
  }
  
  
  
  dependencies {
      def multidex_version = "2.0.1" // Check this from the link
      def lifecycle_version = "2.1.0"
      implementation "androidx.multidex:multidex:$multidex_version"
  
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
      implementation 'androidx.appcompat:appcompat:1.1.0'
      implementation 'androidx.core:core-ktx:1.1.0'
      implementation 'com.google.android.material:material:1.0.0'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      implementation 'androidx.navigation:navigation-fragment:2.1.0'
      implementation 'androidx.navigation:navigation-ui:2.1.0'
      implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
      implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
      implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-rc03'
      implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
      implementation "androidx.navigation:navigation-fragment-ktx:$lifecycle_version"
      implementation "androidx.navigation:navigation-ui-ktx:$lifecycle_version"
      implementation 'androidx.legacy:legacy-support-v4:1.0.0'
      implementation 'androidx.fragment:fragment-ktx:1.1.0'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
      implementation 'androidx.room:room-runtime:2.2.2'
      kapt 'androidx.room:room-compiler:2.2.2'
      implementation 'com.squareup.retrofit2:retrofit:2.7.0'
  
      implementation 'com.google.dagger:dagger:2.25.2'
      api 'com.google.dagger:dagger:2.25.2'
  
      api 'com.google.dagger:dagger-android:2.25.2'
      api 'com.google.dagger:dagger-android-support:2.25.2'
      kapt 'com.google.dagger:dagger-compiler:2.25.2'
      kapt 'com.google.dagger:dagger-android-processor:2.25.2'
      implementation 'org.jetbrains.kotlin:kotlin-script-runtime:1.3.61'
  
  }
  </code></pre>
  
  <p><strong>build:gradle(Project)</strong></p>
  
  <pre><code>buildscript {
      ext.kotlin_version = '1.3.61'
      repositories {
          google()
          jcenter()
  
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.5.3'
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
  
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  
  <p><strong>Error log</strong></p>
  
  <p>gradlew clean assembleDebug</p>
  
  <pre><code>Task :app:kaptGenerateStubsDebugKotlin FAILED
  e: org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException: Descriptor wasn't found for declaration SCRIPT
          at org.jetbrains.kotlin.resolve.lazy.BasicAbsentDescriptorHandler.diagnoseDescriptorNotFound(AbsentDescriptorHandler.kt:18
  )
          at org.jetbrains.kotlin.resolve.lazy.BasicAbsentDescriptorHandler.diagnoseDescriptorNotFound(AbsentDescriptorHandler.kt:17
  )
          at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.findClassDescriptor(LazyDeclarationResolver.kt:88)
          at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.getScriptDescriptor(LazyDeclarationResolver.kt:65)
          at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver$resolveToDescriptor$1.visitScript(LazyDeclarationResolver.kt:
  204)
          at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver$resolveToDescriptor$1.visitScript(LazyDeclarationResolver.kt:
  94)
          at org.jetbrains.kotlin.psi.KtScript.accept(KtScript.java:69)
          at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.resolveToDescriptor(LazyDeclarationResolver.kt:94)
          at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.resolveToDescriptor(LazyDeclarationResolver.kt:91)
          at org.jetbrains.kotlin.resolve.lazy.ResolveSession.resolveToDescriptor(ResolveSession.java:329)
          at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension$doAnalysis$1.invoke(PartialAnalysisHandlerE
  xtension.kt:64)
          at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension$doAnalysis$1.invoke(PartialAnalysisHandlerE
  xtension.kt:34)
          at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doForEachDeclaration(PartialAnalysisHandler
  Extension.kt:121)
          at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doForEachDeclaration(PartialAnalysisHandler
  Extension.kt:135)
          at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doAnalysis(PartialAnalysisHandlerExtension.
  kt:63)
          at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.doAnalysis(Kapt3Extension.kt:145)
          at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacade
  ForJVM.kt:105)
          at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyz
  erFacadeForJVM.kt:82)
          at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:557)
          at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:82)
          at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
  
          at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:548)
          at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:177
  )
          at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:165)
          at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:55)
          at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
          at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
          at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
          at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:349)
          at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
          at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:237)
          at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
  
          at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:79)
          at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:91)
          at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:606)
          at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:99)
          at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1645)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
          at sun.rmi.transport.Transport$1.run(Transport.java:200)
          at sun.rmi.transport.Transport$1.run(Transport.java:197)
          at java.security.AccessController.doPrivileged(Native Method)
          at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
          at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
          at java.security.AccessController.doPrivileged(Native Method)
          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
  </code></pre>