首页 > 解决方案 > 编译数据绑定时出错:-任务“:app:kaptDebugKotlin”执行失败

问题描述

大家好,我在android中进行数据绑定时遇到了一个错误

运行代码时显示以下错误:org.gradle.api.tasks.TaskExecutionException:任务':app:kaptDebugKotlin'的执行失败

这在破坏项目时显示为错误。

在此处输入图像描述

在此处输入图像描述

这些是我的项目的详细信息,我无法理解我的 gradle 代码有什么问题

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
    applicationId "com.snake.implimetations"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

android {
    dataBinding {
        enabled = true
    }
}

}

dependencies {

def lifecycle_version = "1.+"

implementation fileTree(dir: 'libs', include: ['*.jar'])

//support
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

// database
implementation 'androidx.room:room-rxjava2:2.1.0'
kapt 'androidx.room:room-compiler:2.1.0'

// font
implementation "uk.co.chrisjenx:calligraphy:$rootProject.calligraphyVersion"

//viewModel and LiveData
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
kapt 'androidx.lifecycle:lifecycle-compiler:2.0.0'

// parser
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"

// Dagger 2
implementation 'com.google.dagger:dagger-android-support:2.17'
implementation 'com.google.dagger:dagger:2.17'
kapt "com.google.dagger:dagger-compiler:2.17"
kapt "com.google.dagger:dagger-android-processor:2.17"

// network
implementation "com.amitshekhar.android:rx2-android-networking:$rootProject.rx2FastAndroidNetworking"

// reactive
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava2Version"
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxandroidVersion"

//htttp
implementation('org.apache.httpcomponents:httpmime:4.3.6') {
    exclude module: 'httpclient'
}
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'


implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"


testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'

implementation 'com.google.android.material:material:1.0.0'
implementation 'org.jetbrains:annotations:15.0'

}

标签: androidmvvmdata-binding

解决方案


推荐阅读