Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execution failed for task ':app:kaptGenerateStubsDebugKotlin' after android studio V3.1.1 update

I just updated android studio to V3.1.1. Then my program went wrong. When build the program,there are two errors:

enter image description here

  1. One in 'Run build':

    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptGenerateStubsDebugKotlin'

enter image description here

  1. Another in Java compiler:

java.lang.ClassNotFoundException: org.jetbrains.kotlin.resolve.checkers.SimpleDeclarationChecker enter image description here

Here is my gradle:

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'

}
like image 407
restress Avatar asked Apr 14 '18 12:04

restress


People also ask

How do I change my kotlin Android version?

Update to a new release You can check the Kotlin version in Tools | Kotlin | Configure Kotlin Plugin Updates. If you have projects created with earlier Kotlin versions, change the Kotlin version in your projects and update kotlinx libraries if necessary.

How do I upgrade kotlin in flutter?

Go to External Libraries / Flutter Plugins / google_api_availability / android / build. gradle and changed ext. kotlin_version to LATEST_VERSION. Save this answer.


1 Answers

Well,I finally get over this. When I use --stacktrace,I find the :app:kaptDebugKotlin is a procedure in BUILDING an android program. --stacktrace result picture

And I get the error java.lang.ClassNotFoundException: org.jetbrains.kotlin.resolve.checkers.SimpleDeclarationChecker in this :app:kaptDebugKotlin procedure.

I doubt that there're something new in kotlin implementation,so I update my kotlin_version from 1.2.21 to 1.2.30.

Then I get more clear errors.That is the room parameters errors. room error

So I change the arg0 to the parameter name in Dao functions in SQL query.

Finally it works.

like image 145
restress Avatar answered Oct 04 '22 10:10

restress