gpt4 book ai didi

android - Gradle 项目同步失败,Kotlin

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

我使用的是 Beta Kotlin 和 Android-Studio channel 。更新到最新版本后,我遇到了一些 gradle 同步错误。

以下是我从事件日志中复制的日志:

Error:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39.
Searched in the following locations:
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
Required by:
project :

下面是build.gradle

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

buildscript {
ext.kotlin_version = '1.2.0-rc-39'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
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
}

下面是应用程序build.gradle:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 26
defaultConfig {
applicationId "com.udebest.myapplication"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
postprocessing {
removeUnusedCode false
removeUnusedResources false
obfuscate false
optimizeCode false
proguardFile '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.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

拜托,有人对此有想法吗?我真的不知道我该如何解决这个问题?我在那里找不到任何解决方案。

最佳答案

buildscriptallprojects 中的 repositories 更改为:

{
google()
jcenter()
mavenCentral()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev/'
}
}

这对我有用。

关于android - Gradle 项目同步失败,Kotlin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47447877/

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