java 更新到 Android Studio 3.1 后,我遇到了这个错误:找不到 org.jetbrains.kotlin:kotlin-stdlib-jre8:1.2.0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49534872/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 10:23:08  来源:igfitidea点击:

After update to Android Studio 3.1 I'm facing this error: Could not find org.jetbrains.kotlin:kotlin-stdlib-jre8:1.2.0

javaandroidandroid-studiokotlinandroid-gradle-plugin

提问by Mohamed Ramadan

After updating to Android Studio 3.1, I'm facing this error.

更新到 Android Studio 3.1 后,我遇到了这个错误。

Note: I'm using Java not Kotlin

注意:我使用的是 Java 而不是 Kotlin

Could not find org.jetbrains.kotlin:kotlin-stdlib-jre8:1.2.0.

Searched in the following locations:
    https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.pom
    https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.jar
    https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.pom
    https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.jar
Required by:
    project :app > com.android.tools.build:gradle:3.1.0 > com.android.tools.build:gradle-core:3.1.0
    project :app > com.android.tools.build:gradle:3.1.0 > com.android.tools.build:gradle-core:3.1.0 > com.android.tools.build:builder:3.1.0
    project :app > com.android.tools.build:gradle:3.1.0 > com.android.tools.build:gradle-core:3.1.0 > com.android.tools.lint:lint-gradle-api:26.1.0
    project :app > com.android.tools.build:gradle:3.1.0 > com.android.tools.build:gradle-core:3.1.0 > com.android.tools.build:gradle-api:3.1.0
    project :app > com.android.tools.build:gradle:3.1.0 > com.android.tools.build:gradle-core:3.1.0 > com.android.databinding:compilerCommon:3.1.0
    project :app > com.android.tools.build:gradle:3.1.0 > com.android.tools.build:gradle-core:3.1.0 > com.android.tools.build:builder:3.1.0 > com.android.tools:sdk-common:26.1.0
    project :app > com.android.tools.build:gradle:3.1.0 > com.android.tools.build:gradle-core:3.1.0 > com.android.tools.build:builder:3.1.0 > com.android.tools.build:manifest-merger:26.1.0
    project :app > com.android.tools.build:gradle:3.1.0 > com.android.tools.build:gradle-core:3.1.0 > com.android.tools.build:builder:3.1.0 > com.android.tools:sdklib:26.1.0 > com.android.tools:repository:26.1.0

采纳答案by Mohamed Ramadan

Working like this

像这样工作

buildscript {
    ext.kotlin_version = '1.1.1'  //Add this line
    repositories {
        jcenter()
        google()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

回答by EpicPandaForce

JCenter was being cranky the other day, so following should help:

前几天 JCenter 脾气暴躁,因此以下内容应该会有所帮助:

    repositories {
        mavenCentral() // <-- add this at top
        google()
        jcenter()
    }

回答by Christoph

Add the JCenter repo to your Project-level build.gradlefile:

将 JCenter 存储库添加到您的项目级build.gradle文件:

buildscript {
    dependencies {
        repositories {
            //...
            google()
            jcenter() // <--- this is needed
        }

        classpath 'com.android.tools.build:gradle:3.1.0'
    }
}

回答by patrick.1729

Add the following to your Project gradle file:

将以下内容添加到您的项目 gradle 文件中:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
    }
}