【发布时间】:2020-12-24 21:15:55
【问题描述】:
我有一个新的 Android 项目,我想使用 Jetpack Compose,但是按照outlined here 的步骤操作会出现以下构建错误:
Unable to load class 'org.jetbrains.kotlin.gradle.tasks.KotlinCompile'.
This is an unexpected error. Please file a bug containing the idea.log file.
也许我使用 Kotlin DSL build.gradle.kts 使问题更加复杂,但这是我的 gradle 设置:
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("kotlin-kapt")
id("dagger.hilt.android.plugin")
}
android {
compileSdkVersion(30)
defaultConfig {
applicationId = "..."
minSdkVersion(24)
targetSdkVersion(30)
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility(JavaVersion.VERSION_1_8)
targetCompatibility(JavaVersion.VERSION_1_8)
}
buildFeatures {
dataBinding = true
compose = true
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true
}
composeOptions {
kotlinCompilerVersion = "1.4.20"
kotlinCompilerExtensionVersion = "1.0.0-alpha08"
}
}
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
//...
}
【问题讨论】:
-
你解决了吗?
标签: android kotlin android-jetpack-compose