【问题标题】:Kotlin version 1.1.4-eap-77 is not workingKotlin 版本 1.1.4-eap-77 不工作
【发布时间】:2017-08-21 18:27:28
【问题描述】:

我在 Kotlin 中启动了一个新应用程序,但是当 Android Studio 完成构建新项目等时,表示可以下载正确版本的 Kotlin:

这是构建等级:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.1.4-eap-77'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

和应用程序 gradle:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.xxxxxx.xxxxxx"
        minSdkVersion 20
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.0.1'
    implementation 'com.android.support:design:26.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'
}

如何修复它以允许下载正确的版本?

【问题讨论】:

  • Kotlin 1.1.4 已经发布;目前绝对不需要使用 EAP 版本。

标签: android android-gradle-plugin kotlin updates


【解决方案1】:

使用 EAP 版本 kotlin 插件,您必须在 buildscript 块中添加 repo

maven {
            url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1'
      }

类似:

buildscript {
    ext.kotlin_version = '1.1.4-eap-77'
    repositories {
        google()
        jcenter()
        maven {
              url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1'
        }
    }
    //...
}

您还应该将相同的 maven 存储库添加到 repository 块以下载 kotlin 依赖项。

类似:

repositories {
    google()
    jcenter()
    maven {
        url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1'
    }
}

你可以找到更多info here.

【讨论】:

猜你喜欢
  • 2023-03-13
  • 1970-01-01
  • 2017-09-01
  • 2010-11-23
  • 2015-11-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-30
相关资源
最近更新 更多