Avatar ·

Kotlin编译错误:compileDebugKotlin — 怎么办?

大家好!我刚开始学习用于Android的Kotlin,在构建项目时遇到了问题。Gradle报错: ``` Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details ``` 我翻遍了整个Stack Overflow,但没有找到明确的解决方案。项目是通过Android Studio使用Empty Activity模板创建的。代码很简单——只是在TextView中输出"Hello, World!"。 这是我的`build.gradle` (Module: app): ```kotlin plugins { id("com.android.application") id("org.jetbrains.kotlin.android") } android { namespace = "com.example.myapp" compileSdk = 34 defaultConfig { applicationId = "com.example.myapp" minSdk = 24 targetSdk = 34 versionCode = 1 versionName = "1.0" } buildTypes { release { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")