gradle 模块使用不兼容的Kotlin版本编译,其元数据的二进制版本为1.9.0,在Flutter android中预期版本为1.6.0

mrphzbgm  于 4个月前  发布在  Kotlin
关注(0)|答案(1)|浏览(74)

在Visual Studio Code中对我的项目运行flutter build apk时,我收到下面复制的一组错误消息。应用程序运行正常,但我担心警告消息。自从6个月前首次构建应用程序以来,我一直保持应用程序的依赖关系最新。
我正在使用gradle-7.6,这是我的build.gradle文件:

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

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        // START: FlutterFire Configuration
        classpath 'com.google.gms:google-services:4.3.15'
        // END: FlutterFire Configuration
        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')
}
//  compileJava.options.fork = true
//  compileJava.options.forkOptions.executable = 'C:\\Program Files\\Java\\jdk-19\\bin'
tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

字符串
这是错误消息:

e: D:/TASK/2023/Lyle/spider_app/flutter_spider/build/dynamic_color/.transforms/fd0f6b36ccddfa35f479defd74ccfef7/transformed/out/jars/classes.jar!/META-INF/dynamic_color_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0. e: D:/TASK/2023/Lyle/spider_app/flutter_spider/build/map_launcher/.transforms/d77f86b0454ba18e42782d576fb8f2ec/transformed/out/jars/classes.jar!/META-INF/map_launcher_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0. e: D:/TASK/2023/Lyle/spider_app/flutter_spider/build/package_info_plus/.transforms/1d9f4bdf3986bd1b9069e9c4e337c511/transformed/out/jars/classes.jar!/META-INF/package_info_plus_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/0e549f58bb3f04e335ea98020fe770fa/transformed/jetified-play-services-measurement-api-21.5.0/jars/classes.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/3861ef6ed1cb712d0b4a38940362b17f/transformed/jetified-ads-adservices-java-1.0.0-beta05/jars/classes.jar!/META-INF/ads-adservices-java_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/ae6c92956fbad130ba0945f0499090d1/transformed/jetified-ads-adservices-1.0.0-beta05/jars/classes.jar!/META-INF/ads-adservices_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.7.1/63a0779cf668e2a47d13fda7c3b0c4f8dc7762f4/kotlinx-coroutines-core-jvm-1.7.1.jar!/META-INF/kotlinx-coroutines-core.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-play-services/1.7.1/6333bad6f256e2ca7bc2908f586be7161a41618c/kotlinx-coroutines-play-services-1.7.1.jar!/META-INF/kotlinx-coroutines-play-services.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/1f26cf07b485507537ccc43a816ebf2f/transformed/fragment-1.6.1/jars/classes.jar!/META-INF/fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/d6115b8e7eae20c1343ade39c8d9aa9f/transformed/jetified-activity-1.7.2/jars/classes.jar!/META-INF/activity_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/516894713d59bd1bc66b6ad0c669fe74/transformed/lifecycle-livedata-2.6.1/jars/classes.jar!/META-INF/lifecycle-livedata_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/885e01b5f6fb27b0ec75aa9ffaf9902b/transformed/lifecycle-viewmodel-2.6.1/jars/classes.jar!/META-INF/lifecycle-viewmodel_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/e39b5ad84f4c5878df091082af4f8dd2/transformed/lifecycle-livedata-core-2.6.1/jars/classes.jar!/META-INF/lifecycle-livedata-core_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/02125d6d3ed045893a68e42f26427c3d/transformed/jetified-lifecycle-viewmodel-savedstate-2.6.1/jars/classes.jar!/META-INF/lifecycle-viewmodel-savedstate_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/036e980e994b82a8a795b66945867f99/transformed/jetified-core-ktx-1.10.1/jars/classes.jar!/META-INF/core-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/677f9f96d37be3c92737b7ab1a356ef9/transformed/core-1.10.1/jars/classes.jar!/META-INF/core_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/2ec8138814cf59a84bead4f8debaa024/transformed/lifecycle-runtime-2.6.1/jars/classes.jar!/META-INF/lifecycle-runtime_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.6.1/10f354fdb64868baecd67128560c5a0d6312c495/lifecycle-common-2.6.1.jar!/META-INF/lifecycle-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-android/1.7.1/c2d86b569f10b7fc7e28d3f50c0eed97897d77a7/kotlinx-coroutines-android-1.7.1.jar!/META-INF/kotlinx-coroutines-android.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/transforms-3/c385a649bfb20a00bfef5522331f566a/transformed/jetified-savedstate-1.2.1/jars/classes.jar!/META-INF/savedstate_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0. e: C:/Users/pdev/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.9.10/dafaf2c27f27c09220cee312df10917d9a5d97ce/kotlin-stdlib-common-1.9.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.

q5iwbnjs

q5iwbnjs1#

当用于编译模块的Kotlin编译器与使用模块的预期版本之间存在版本不匹配时,通常会发生此错误。在Flutter中,当集成使用Kotlin的原生Android模块或包时,可能会出现此问题。
1.更新Flutter和Dart确保您使用的是最新版本的Flutter和Dart。在您的终端中运行以下命令:
Flutter升级
1.更新Gradle插件确保您的android/build.gradle文件使用的是最新版本的Gradle插件。打开该文件并更新Gradle插件版本:
buildscript { repositories { google()jcenter()}
依赖关系{ classpath 'com.android.tools.build:gradle:7.0.0' //使用最新版本} }
1.更新Kotlin版本更新android/build.gradle文件中的Kotlin版本:
ext.Kotlin_version = '1.6.0' //使用预期版本
1.在Android Studio中,转到“文件”->“无效缓存/重新启动.”->“无效并重新启动”。
1.检查兼容性确保您的android/app/build.gradle文件中的所有依赖项和插件与您正在使用的Kotlin版本兼容。
1.在项目目录中运行以下命令:
Flutter clean flutter pub get flutter run
试试这个

相关问题