gpt4 book ai didi

android - android studio 中的 Kotlin

转载 作者:太空宇宙 更新时间:2023-11-03 13:45:12 25 4
gpt4 key购买 nike

我正在使用 kotlin,但是当我在我的项目中同步它时,出现以下错误:

Error:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-3.
Searched in the following locations:
file:/D:/android-studio/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.2-3/kotlin-gradle-plugin-1.1.2-3.pom
file:/D:/android-studio/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.2-3/kotlin-gradle-plugin-1.1.2-3.jar
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.2-3/kotlin-gradle-plugin-1.1.2-3.pom
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.2-3/kotlin-gradle-plugin-1.1.2-3.jar
Required by:
project :

这是我的 build.gradle(Module) :

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

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "ir.baslam.kotlinme"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
mavenCentral()
}

这是我的build.gradle(project):

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

buildscript {
ext.kotlin_version = '1.1.2-3'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.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
}
}

allprojects {
repositories {
jcenter()
}
}

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

最佳答案

ext.kotlin_version = '1.1.2-3'

'1.1.2-3' 版本在 jcenter 存储库中不可用,在您的文件系统中也不可用。

因为我检查了最新版本 1.1.2-2 在 jcenter 中可用,最后一次更新是在 2017 年 4 月 28 日,所以请改用 1.1.2-2 版本1.1.2-3

ext.kotlin_version = '1.1.2-2'

关于android - android studio 中的 Kotlin ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43775942/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com