我有我在Android工作室Java
启动了一个项目,我想继续它Kotlin
。所以我配置我的项目通过这种方式“配置科特林在项目”整合科特林
在那之后的Android工作室改变了我两次build.gradle
文件。但是,从那个时候起我开始同步失败。
还有就是我的build.gradle
文件,其中的错误发生:
之前:
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
后:
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.2.0'
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
}
repositories {
mavenCentral()
}
allprojects {
repositories {
google()
jcenter()
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我得到以下错误:
无法添加任务“干净”与已存在同名的任务。
当我删除该任务干净我得到的错误:
1
创建之后,新的科特林项目,并拍了一下有关build.gradle
文件
我适应矿山和它的工作,以及!
还有就是我目前的build.gradle
文件
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
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
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}