For a start - I googled a lot on the bugs that I get and used and tried everything I found. However, I continue to receive them.

My build.gradle project file looks like this

buildscript { ext.kotlin_version = "1.2.31" repositories { google() jcenter() } dependencies { ..... classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" ..... } } 

module level build.gradle looks like this

 apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { ......... androidExtensions { experimental = true } } dependencies { .......... // kotlin implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" ......... } 

But I keep getting the following errors.

 e: \pages\BaseActivity.kt: (16, 9): Unresolved reference: window e: \pages\GameActivity.kt: (37, 21): Unresolved reference: startActivity e: \pages\MenuActivity.kt: (30, 21): Unresolved reference: startActivity e: \util\FileUtil.kt: (19, 31): Unresolved reference: assets e: \util\FileUtil.kt: (21, 51): Unresolved reference: it e: \viewmodel\MenuViewModel.kt: (42, 70): Unresolved reference: finish 

As you can see, references to standard methods such as 'startActivity' or 'finish' are not recognized. Why then the cotlin cannot recognize them?

I started getting these errors after the project was uploaded - the version of the gredl and the gredl of the plug-in, the version of the plug-in cotlin and the versions of many libraries, but after I tried to sell it all, the errors did not go away.

Nobody started with such a problem?

    2 answers 2

    I found a solution. It was a dependency that broke the build.

     implementation group: 'com.h2database', name: 'h2', version: '1.3.148' 

    I added it in order to test Exposed at the same time as updating all versions in build.gradle, so I didn’t pay attention to it right away, I decided that it was an update of some kind of plug-in or build of the version.

    So if you get a scoop of similar errors - the problem may be depending, which breaks the assembly, try to comment out the last added ones and see if this helps.

      In the build.gradle the project level, add the following dependency:

       buildscript { ..... dependencies { ..... classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" ..... } } 

      And after rebuild the project

      • I tried this solution, but it did not work + from the version of the plug-in 1.3, it seems, this dependence is not necessary to add. I found a solution, now I will write the answer - iamthevoid