To begin with – I went a lot of mistakes that I get and used and tried everything that 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"
.....
}
}
build.gradle module level 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 continue to receive 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 may notice – there are no references to standard methods, such as ‘Startactivity’ or ‘Finish’. Why then Kotlin cannot recognize them?
I started receiving these errors after the project of the project – the version of the Gredal and Hredle plugin, the version of the Kotlin plugin and the versions of many libraries, but after I tried all this to sell – mistakes did not leave.
Nobody stalked with such a problem?
Answer 1, Authority 100%
I found a solution. It was a dependence that broke the assembly.
IMPLEMENTATION GROUP: 'COM.H2DATABASE', NAME: 'H2', VERSion: '1.3.148'
I added it to test the exposed at one time with the update of all versions in Build.gradle, so I did not pay attention to it immediately, I decided that it was an update of some kind of plugin or Bild Warred.
So if you get scope of these errors – the problem may be dependent on which it breaks the assembly, try to comment out the latest added and see whether it will help
Answer 2
in build.gradle
Project level Add this dependency:
Buildscript {
.....
Dependencies {
.....
Classpath "Org.jetbrains.kotlin: Kotlin-Android-Extensions: $ kotlin_version"
.....
}
}
and after reset the project