我刚刚将 android studio 更新到 V3.1.1。然后我的程序出错了。编译程序时,有两个错误:
“运行构建”中的一个:
org.gradle.api.tasks.TaskExecutionException:任务':app:kaptGenerateStubsDebugKotlin'的执行失败
- Java编译器中的另一个:
java.lang.ClassNotFoundException: org.jetbrains.kotlin.resolve.checkers.SimpleDeclarationChecker 在此处输入图像描述
这是我的毕业典礼:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.restress.saniauto"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
buildToolsVersion '27.0.3'
}
androidExtensions {
experimental = true
}
buildscript {
ext.kotlin_version = '1.2.21'
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.22.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.8'
implementation 'io.reactivex:rxkotlin:0.55.0'
//Room & RxAndroid2
implementation "android.arch.persistence.room:runtime:$room_version"
implementation "android.arch.persistence.room:rxjava2:$room_version"
kapt "android.arch.persistence.room:compiler:$room_version"
kapt "android.arch.persistence.room:compiler:$room_version"
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation "android.arch.persistence.room:testing:$room_version"
//Design
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:percent:26.1.0'
}