kejin
1
This problem appear on android studio 2.0, but it work fine on Android Studio 1.5.1
Heere is my code
class ExRecyclerView: RecyclerView {
private val headerViews: MutableList<View> = mutableListOf()
private val footerViews: MutableList<View> = mutableListOf()
.....
}
The android studio rendering problems
java.lang.NoSuchMethodError: kotlin.collections.CollectionsKt.mutableListOf([Ljava/lang/Object;)Ljava/util/List;
yole
2
Please ensure that your project references the correct version of the Kotlin runtime library in its build.gradle.
kejin
3
My kotlin version is 1.0.1, the lastest version
Here is my module buid.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "cn.kejin.gitbook"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
androidTest.java.srcDirs += 'src/androidTest/kotlin'
}
}
dependencies {
....
compile 'org.jetbrains.kotlin:kotlin-android-extensions:1.0.0'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
....
}
buildscript {
ext.kotlin_version = '1.0.1'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
repositories {
jcenter()
}
Here is the root project build.gradle
buildscript {
ext.kotlin_version = '1.0.1'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
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 {
jcenter()
}
}