首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Gradle中添加kapt一直没成功,求解?

Gradle中添加kapt一直没成功,求解?

提问于 2024-05-18 16:56:33
回答 0关注 0查看 25

在添加kotlin-kapt插件时一直没有成功

以下是我的app/build.gradle文件内容

代码语言:txt
复制
plugins {
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.jetbrainsKotlinAndroid)
}
apply( plugin = "com.android.application")
apply( plugin = "kotlin-android")
apply( plugin = "kotlin-kapt")

android {
    namespace = "com.example.jetpacktest"
    compileSdk = 34

    buildFeatures {
        viewBinding = true
    }

    defaultConfig {
        applicationId = "com.example.jetpacktest"
        minSdk = 21
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}


dependencies {
    implementation ("androidx.lifecycle:lifecycle-livedata-ktx:2.2.0")
    implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.appcompat)
    implementation(libs.material)
    implementation(libs.androidx.activity)
    implementation(libs.androidx.constraintlayout)
    
    
    implementation("androidx.room:room-runtime:2.1.0")
    kapt ("androidx.lifecycle:lifecycle-compiler:$lifecycle_version")
    
    
    
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
}
报错
报错

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档