简体   繁体   English

Kotlin 停留在 1.3.31 版本的 Android Studio 项目上

[英]Kotlin stuck on version 1.3.31 Android Studio project

I'm new to this, I bought a Flutter project and am trying to start it in Android Studio.我是新手,我买了一个 Flutter 项目,并试图在 Android Studio 中启动它。

The project used an older version of Android Gradle and I updated it to 7.0.2.该项目使用了旧版本的 Android Gradle,我将其更新为 7.0.2。 But now when I try to build, I get the error:但是现在当我尝试构建时,出现错误:

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher. Android Gradle 插件仅支持 Kotlin Gradle 插件版本 1.3.40 及更高版本。

I checked the file android/ build.gradle ext.kotlin_version = '1.3.50'我检查了文件 android/ build.gradle ext.kotlin_version = '1.3.50'

Here is the complete file:这是完整的文件:

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
        maven {
          url "https://dl.bintray.com/kotlin/kotlin-eap/"
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.0'
    }
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

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

I tried to change many versions but always the result is the same.我尝试更改许多版本,但结果总是相同。 I checked a lot of answers but still couldn't find what else could be the reason.我查了很多答案,但仍然找不到其他可能的原因。

Try this:尝试这个:

buildscript {
ext.kotlin_version = '1.5.30'
repositories {
    google()
    mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:4.2.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.3.10'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
}

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM