对build.gradle文件进行更改后,Kotlin编译器会引发注释错误

时间:2019-05-31 10:10:12

标签: android gradle mvvm kotlin androidx

我对build.gradle(app)文件进行了以下更改。

apply plugin: 'kotlin-kapt'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.material:material:1.1.0-alpha07'

    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0-alpha01'
    kapt 'androidx.lifecycle:lifecycle-compiler:2.0.0-rc01'

    implementation 'androidx.room:room-runtime:2.1.0-rc01'
    kapt  'androidx.room:room-compiler:2.0.0-rc01'

    implementation 'androidx.paging:paging-runtime:2.1.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    implementation 'io.sentry:sentry-android:1.7.16'
    implementation 'org.slf4j:slf4j-nop:1.7.25'
}

现在Kotlin编译器针对我的EntryDAO.ktEntryDatabase.kt文件抛出以下错误:

enter image description here

1 个答案:

答案 0 :(得分:0)

错误消息很清楚。 会议室的“删除,更新方法”签名已更改。它需要返回void或int。

编辑:我再次检查,您的gradle文件混合了androidx库和Lifecycle的AndroidX以前版本。

请点击链接以使用正确的库组合:https://developer.android.com/jetpack/androidx/releases/lifecycle