相关疑难解决方法(0)

build.gradle文件中的compileKotlin块抛出错误"找不到参数[...]的方法compileKotlin()"

我正在尝试将Kotlin配置为在我的Android项目中使用Java 1.8.我已经尝试compileKotlin在我的build.gradle文件底部添加块,但如果我这样做,我会收到错误.

发生的错误如下:

错误:(38,0)无法在类型为org.gradle.api.Project的项目':core'上找到参数[build_dvcqiof5pov8xt8flfud06cm3 $ _run_closure4 @ 66047120]的方法compileKotlin().

没有这个块,项目运行良好.我错过了什么?这是完整的build.gradle文件,它是非常基本的东西:

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'


android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'


    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 25
        versionCode 1
        versionName '1.0.0'

        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    compile 'com.google.android.support:wearable:2.0.2'
}

repositories {
    mavenCentral()
}

compileKotlin {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8

    kotlinOptions {
        jvmTarget = '1.8'
        apiVersion = …
Run Code Online (Sandbox Code Playgroud)

android gradle kotlin

43
推荐指数
4
解决办法
9832
查看次数

标签 统计

android ×1

gradle ×1

kotlin ×1