Reputation: 438
At first - I've been googling to much and use all, what I am found.
My project level build.gradle contains this
at root of file
buildscript {
ext.kotlin_version = "1.2.31"
repositories {
google()
jcenter()
}
dependencies {
.....
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
.....
}
}
My module level build.gradle contains this
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "iam.thevoid.sudoku"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
vectorDrawables.useSupportLibrary = true
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
dataBinding {
enabled = 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 still continue getting the errors during the build
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 - there are simple references, as 'startActivity' or 'finish'. Why does kotlin can not resolve it?
I started get these errors when I've updated something i did not remember. Maybe it was a kotlin plugin version, may be there was an gradle or gradle plugin, but i try downgrade this plugins and not return project in working version.
Can you help?
Upvotes: 2
Views: 9734
Reputation: 438
I've found problem! There was dependency, which is break the build. In my case it was the
implementation group: 'com.h2database', name: 'h2', version: '1.3.148'
I've added this for testing Exposed, but i did that at the same time when i updated the build.gradle file.
If you got same erros you can also check your dependencies. Probably one of them break the build.
Upvotes: 1