gpt4 book ai didi

android - 升级到 Kotlin 1.2.60、Android Studio 3.1.3 时出错

转载 作者:行者123 更新时间:2023-11-29 16:39:19 25 4
gpt4 key购买 nike

Pretext:除了发布和调试之外,我的项目有 3 个构建变体,我还有暂存变体。

Gradle sync 在 1.2.51 版本中完全正常工作,但是一旦我升级到最近发布的 1.2.60 版本,gradle sync 就会失败并显示以下错误消息:

Could not find method kapt() for arguments[build_9jdgbsb8xiz9dkrq42qtcg5eg$_run_closure1$_closure6@576656b5] onobject of type com.android.build.gradle.LibraryExtension.

任何关于这方面的帮助/见解都会非常好,我尝试搜索了一段时间,但一直停留在要搜索的内容上,我认为这里的问题可能是 kapt 插件变更日志提到其中的变更,检查 this , 但无法让它运行。

依赖:

顶级gradle:

dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.realm:realm-gradle-plugin:$realm_version"
classpath 'com.akaita.android:easylauncher:1.2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}

应用级别:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'

apply plugin: 'realm-android'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

PS:我使用的是 Gradle 插件 4.9、Studio 3.1.3 和 android gradle 插件 3.3.0-alpha03。

谢谢。

最佳答案

我找到了解决这个问题的方法,以防万一,

问题:

我有一个模块依赖,它使用了一些 kapt 方法但没有包含

apply plugin: 'kotlin-kapt' 在它的项目级 build.gradle 文件中。

我添加了它,瞧,它起作用了。

关于android - 升级到 Kotlin 1.2.60、Android Studio 3.1.3 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51653383/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com