Android Kotlin版本1.1.4-eap-77不工作
我在Kotlin启动了一个新应用程序,但当Android Studio完成构建新项目时,等等。。is说cand下载Kotlin的正确版本: 以下是构建梯度:Android Kotlin版本1.1.4-eap-77不工作,android,android-gradle-plugin,kotlin,updates,Android,Android Gradle Plugin,Kotlin,Updates,我在Kotlin启动了一个新应用程序,但当Android Studio完成构建新项目时,等等。。is说cand下载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' repositorie
// 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版本,您必须在
构建脚本
块中添加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'
}
}
//...
}
repositories {
google()
jcenter()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1'
}
}
此外,您还应该将相同的maven repo添加到存储库块,以下载kotlin依赖项
比如:
buildscript {
ext.kotlin_version = '1.1.4-eap-77'
repositories {
google()
jcenter()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1'
}
}
//...
}
repositories {
google()
jcenter()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1'
}
}
您可以找到更多的谢谢,但它不起作用。我举了一个例子,但仍然没有加载repo。@Shudy我用正确的url更新了答案(它是错误的)。我刚刚检查过,它是存在的:Kotlin 1.1.4已经发布;目前绝对不需要使用EAP版本。