我正在尝试新的 Jetpack compose,但是当我切换到 时kapt
,我收到此错误:java.lang.IllegalStateException: Backend Internal error: Exception during code generation
.
它与 annotationProcessor 一起工作得很好,但我想在这个项目中使用 kapt。我将不胜感激。
我知道很多问题都可能导致上述错误,但我认为这个问题是特有的,jetpack
并且kapt
我在.gradle
下面添加了我的文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "me.jerryhanks.pinchme"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// javaCompileOptions {
// annotationProcessorOptions {
// arguments = [
// "room.schemaLocation":"$projectDir/schemas".toString(),
// "room.incremental":"true",
// "room.expandProjection":"true"]
// }
// }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
compose true
}
// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
/**Compose*/
implementation 'androidx.ui:ui-layout:0.1.0-dev02'
implementation 'androidx.ui:ui-material:0.1.0-dev02'
implementation 'androidx.ui:ui-tooling:0.1.0-dev02'
/**Corountine*/
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$versions.coroutine"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versions.coroutine"
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$versions.coroutine"
/**Room*/
implementation "androidx.room:room-runtime:$versions.room"
kapt "androidx.room:room-compiler:$versions.room"
/**Test*/
testImplementation 'junit:junit:4.12'
testImplementation "androidx.room:room-testing:$versions.room"
/**Android Test*/
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}