如何在React Native中设置新的Kotlin和gradle版本?

kokeuurv  于 2023-03-03  发布在  React
关注(0)|答案(1)|浏览(297)

我必须使用一个名为watermelondb的库,要使用它,我必须至少得到Kotlin的1. 3. 5版本,我当前的版本是1. 3. 21,当我试图设置1. 3. 5时,我得到一个错误消息:

Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-6.2-all.zip'.
A problem occurred configuring root project 'espeleoapp'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.5.
Searched in the following locations:
  - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.5/kotlin-gradle-plugin-1.3.5.pom
  - https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.5/kotlin-gradle-plugin-1.3.5.pom
Required by:
    project :Java(0)

我的build.gradle构建脚本如下所示:

buildscript {
    ext.kotlin_version = '1.3.21'

    ext {
        buildToolsVersion = "30.0.0"
        minSdkVersion = 16
        compileSdkVersion = 30
        targetSdkVersion = 30
        supportLibVersion = "30.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.3")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

我的gradle-wrapper.properties是这样的

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

我必须改变什么才能得到正确的Kotlin版本?
我尝试使用不同的版本,但不起作用

c9x0cxw0

c9x0cxw01#

我昨天也有类似的问题。这个可能会有帮助。

buildscript {
ext {
    buildToolsVersion = "30.0.2"
    minSdkVersion = 21
    compileSdkVersion = 31
    targetSdkVersion = 31
    kotlinVersion = "1.5.31"
    supportLibVersion = "28.0.0"
}
repositories {
    google()
    jcenter()
}
dependencies {
    classpath("com.android.tools.build:gradle:4.2.1")
    classpath("com.google.gms:google-services:4.2.0")
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

相关问题