Kotlin Error : Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.0.7

后端 未结 15 1031
闹比i
闹比i 2020-11-30 06:17

I installed the Kotlin plugin into my app (v. v1.1.1-release-Studio2.2-1) and then selected "Configure Kotlin in Project" I selected compiler and runtime version

相关标签:
15条回答
  • 2020-11-30 06:55

    A new solution if you use Android Studio 3.2, I solved this issue by added mavenCentral() to build.gradle of the project:

    buildscript {
        ext.kotlin_version = '1.3.0'
        repositories {
            mavenCentral()
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    
        }
    }
    
    allprojects {
        repositories {
            mavenCentral()
            google()
            jcenter()
        }
    }
    

    You should add the line as this order, the credited is for this answer

    0 讨论(0)
  • 2020-11-30 06:55

    If you are using Android Studio 3.2 & above,then issue will be solved by adding google() & jcenter() to build.gradle of the project:

    repositories {
            google()
            jcenter()
    }
    
    0 讨论(0)
  • 2020-11-30 07:00

    In Project level build.gradle use only this version

    ext.kotlin_version = '1.3.31'

    Remove other versions

    This will only work with the latest version of android studio 3.4

    UPDATE: Try to use the latest version of kotlin with latest Android studio to avoid an error.

    0 讨论(0)
  • 2020-11-30 07:01

    After fixing the build.gradle version, It started working 4.0.0 to 3.5.0

    0 讨论(0)
  • 2020-11-30 07:03

    The split of kotlin-stdlib into kotlin-stdlib-jre7 and kotlin-stdlib-jre8 was only introduced with Kotlin 1.1, that's why the dependency cannot be resolved, the package version simply does not exist.

    It looks like the update to your project files failed at some point and set the Kotlin version to 1.0.7. If this is a new project and there's nothing holding you back from using 1.1.1, I'd switch to that. Your problem should be gone after doing this.

    0 讨论(0)
  • 2020-11-30 07:05

    This is what worked for me: Using Gradle 4.8.1

    buildscript {
        ext.kotlin_version = '1.1.1' 
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'}
    }
    allprojects {
        repositories {
            mavenLocal()
            jcenter()
            google()
            maven {
                url "$rootDir/../node_modules/react-native/android"
            }
        maven {
                url 'https://dl.bintray.com/kotlin/kotlin-dev/'
        }
      }
    }   
    
    0 讨论(0)
提交回复
热议问题