如何解决Flutter中Kotlin版本问题?

问题描述 投票:0回答:2

在遵循自述文件和正确的配置(android)后,我正在使用 auth0_flutter 包在 Flutter 中执行 auth0 我收到一个构建错误:

e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors

kotlin 版本问题 iamge

在互联网上找到解决方案后,我到达了这样的地步:我需要更改构建块内的 android 级别 build.gradle 文件内的 Kotlin 版本,尽管该块不存在,并且我手动添加了

buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
    // Add any necessary dependencies here
}
ext.kotlin_version = '1.7.1'
}

我使用过不同版本的 Kotlin,但仍然遇到相同的错误,

我已阅读我的内容 https://pub.dev/packages/auth0_flutter

android flutter auth0
2个回答
0
投票
buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0' // change according to your version
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" ]
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
    project.evaluationDependsOn(':app')
}

0
投票

转到 android -> build.gradle

ext.kotlin_version = '1.9.20'

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.