在以下任何来源中均未找到插件 [id: 'kotlin-kapt']:Gradle 核心插件和插件存储库

问题描述 投票:0回答:3

我尝试将 Room 添加到我的 Jetpack Compose 项目中,如下所述: https://developer.android.com/jetpack/androidx/releases/room?authuser=1

我得到了这个: enter image description here

我这样做了: (如下所述:https://stackoverflow.com/a/66114787/20009330enter image description here

我得到了这个: enter image description here

这是 github 存储库: https://github.com/folsze/AudioHub

gradle android-gradle-plugin android-jetpack-compose android-room android-jetpack
3个回答
7
投票

您需要将其添加到顶部的 app build.gradle 文件中,它将如下所示:

    plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
}

目前您的 project build.gradle 文件中有它,所以它位于错误的位置。


4
投票

正确的方法是在应用程序级别 build.gradle 的插件范围中添加此行

id 'org.jetbrains.kotlin.kapt'

0
投票

如果您出现此错误,或者未找到“kapt”类型错误,则 id 'org.jetbrains.kotlin.kapt' 将其添加到您的应用程序 build.gradle 插件字段中。

© www.soinside.com 2019 - 2024. All rights reserved.