Kotlin版本1.1.4-eap-77不起作用

我在Kotlin开始了一个新的应用程序,但是当Android Studio完成了新的项目的构建等。是说cand下载正确版本的Kotlin:

在这里输入图像描述

这里是构建gradle:

// 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插件的EAP版本 ,您必须在buildscript块中添加回购

 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 repositoryrepository块下载kotlin的依赖关系。

就像是:

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

你可以在这里找到更多的信息。

Interesting Posts