首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到参数的方法kotlin() [gradle-plugin,1.3.20]

找不到参数的方法kotlin() [gradle-plugin,1.3.20]
EN

Stack Overflow用户
提问于 2019-02-02 01:21:35
回答 1查看 3.2K关注 0票数 3

我完全复制了科特林·格拉德尔医生说来实现kotlin插件,但是它返回了以下错误:

Could not find method kotlin() for arguments [gradle-plugin, 1.3.20] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

my gradle

代码语言:javascript
复制
buildscript {
    ext.kotlin_version = '1.3.0'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath(kotlin("gradle-plugin", version = "1.3.20"))

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
//    ext {
//        navigationVersion = '28.0.0'
//    }
    plugins {
        kotlin("<...>")
    }
}


allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2019-02-02 01:48:10

build.gradle可以用Groovy或Kotlin编写。您在Groovy (不是Kotlin)中键入build.gradle,但是您已经复制了Kotlin代码。您应该在文档中选择Groovy选项卡:

代码语言:javascript
复制
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:3.3.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
    }

}

这里:https://kotlinlang.org/docs/reference/using-gradle.html#targeting-android

通过创建一个空的Android和Kotlin项目,您也可以找到一个不错的例子。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54489134

复制
相关文章

相似问题

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