我是 Kotlin 应用程序开发的初学者。当我尝试构建应用程序时发生以下错误 -
e: C:/Users/Lenovo/.gradle/caches/transforms-2/files-2.1/32f0bb3e96b47cf79ece6482359b6ad2/jetified-kotlin-stdlib-jdk7-1.5.0.jar!/META-INF/kotlind-modulestd_kotlind : 模块是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本为 1.5.1,预期版本为 1.1.16
是关于更新模块吗?那怎么更新呢?
尝试将我的 Flutter 应用程序编译到 Android 模拟器时,我遇到了这个令人讨厌的错误。这是错误日志(太长,无法完全粘贴):
在调试模式下在 sdk gphone x86 上启动 lib/main.dart...运行 Gradle 任务“assembleDebug”... 注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。e:在依赖项中发现不兼容的类。从类路径中删除它们或使用“-Xskip-metadata-version-check”来抑制错误 e: /Users/reinier/.gradle/caches/transforms-2/files-2.1/24fa3aa8d2270e5eb067bbe36e9b7563/jetified-kotlin-stdlib-1 10.jar!/META-INF/kotlin-stdlib.kotlin_module:模块是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本为 1.5.1,预期版本为 1.1.15。e: /Users/reinier/.gradle/caches/transforms-2/files-2.1/4d4ccf1034ba5937e6e7ba3aa34d2661/jetified-core-ktx-1.6.0-beta02-api.jar!/META-INF/core-ktlinx_release.module: 模块是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本为 1.5.1,预期版本为 1.1.15。e: /Users/reinier/.gradle/caches/transforms-2/files-2.1/77bab1911042ab2c6d5cc0b2e2ee053c/jetified-kotlin-stdlib-common-1.5.10.jar!/META-INF/kotlin-stdlib-Module是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本为 1.5.1,预期版本为 1.1.15。e: /Users/reinier/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt: (18 , 32): 未解决的参考: mutableMapOf e: /Users/reinier/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/ audioplayers/AudioplayersPlugin.kt: (25, 9): Class 'kotlin.Unit' 是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本为 1.5.1,预期版本为 1.1.15。
. . . . .
e: /Users/reinier/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/WrappedSoundPool.kt: (235 , 30): 类 'kotlin.Unit' 是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本为 1.5.1,预期版本为 1.1.15。该类从 /Users/reinier/.gradle/caches/transforms-2/files-2.1/24fa3aa8d2270e5eb067bbe36e9b7563/jetified-kotlin-stdlib-1.5.10.jar!/kotlin/Unit.class 加载
FAILURE:构建失败,出现异常。
- 出了什么问题:任务 ':audioplayers:compileDebugKotlin' 执行失败。
编译错误。查看日志了解更多详情
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 …
我在Flutter 中有这个项目,但由于 Gradle 版本,我已经有几个星期无法构建 apk。我已经尝试了所有方法,但 Flutter 总是返回以下错误:
我已经安装了我发现的每个更新,尽管它显示 Gradle 版本是 4.10.2。
...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\israel.gomes\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\audioplayers-0.17.4\android\build.gradle' line: 25
* What went wrong:
A problem occurred evaluating root project 'audioplayers'.
> Failed to apply plugin [id 'kotlin-android']
> The current Gradle version 4.10.2 is not compatible with the Kotlin Gradle plugin. Please use Gradle 5.3 or newer, or the previous version of the Kotlin plugin.
* Try:
Run with --stacktrace …Run Code Online (Sandbox Code Playgroud) 我正在重建我的 android 项目,它是用 java 编写的,一些类是用 kotlin 编写的。我在谷歌上搜索过,但我的问题没有解决。我在构建项目时遇到以下错误:
/home/bansal/.gradle/caches/transforms-2/files-2.1/0bea321a20a76ca878f594ef198fedcf/jetified-core-ktx-1.10.0-alpha02-api.jar!/META-INF/core-ktx_release.kotlin_module:模块已编译与 Kotlin 版本不兼容。其元数据的二进制版本是1.8.0,预期版本是1.6.0。
下面是我的 build.gradel
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
maven {
url 'http://dl.bintray.com/amulyakhare/maven'
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'io.realm:realm-gradle-plugin:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Run Code Online (Sandbox Code Playgroud)
和模块 build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dependencies{
implementation 'androidx.core:core-ktx:1.7.0'
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'android.arch.lifecycle:viewmodel:1.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
//Coroutines
implementation …Run Code Online (Sandbox Code Playgroud) C:/Users/khare/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.0/51736992f422993a1e741051bdf3c12801bc1ca1/kotlin-stdlib-common-1.7.0.jar! /META-INF/kotlin-stdlib-common.kotlin_module:模块是使用不兼容的 Kotlin 版本编译的。其元数据的二进制版本是1.7.1,预期版本是1.5.1。
我应该怎么办 ?如何修复它?
我昨天遇到了这个问题,一起工作的 4 个开发人员也遇到了这个问题。
ext.kotlin_version = '1.6.0'
Run Code Online (Sandbox Code Playgroud)
/Users/user/.gradle/caches/transforms-2/files-2.1/2dce81f10515217cc4bd96ea20deb014/jetified-kotlin-stdlib-common-1.8.0.jar!/META-INF/kotlin-stdlib-common.kotlin_module:模块已编译与 Kotlin 版本不兼容。其元数据的二进制版本是1.8.0,预期版本是1.6.0。
当我删除 kotlin 时,所有相关设置都不会遇到这个问题
我希望通过使用 kotlin v1.6.0 来帮助解决这个问题
在 Windows 中运行时出现以下错误flutter build apk(使用 VSCode)
\n\n\n其元数据的二进制版本是1.8.0,预期版本是1.6.0。
\n
但是,在我的 build.gradle 中,我有:
\nbuildscript {\n ext.kotlin_version = \'1.7.10\'\n repositories {\n google()\n mavenCentral()\n }\n\n dependencies {\n classpath \'com.android.tools.build:gradle:7.2.0\'\n classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"\n classpath \'com.google.gms:google-services:4.3.15\'\n\n classpath \'com.google.firebase:firebase-crashlytics-gradle:2.8.1\'\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n真是迷茫啊!为什么它不使用 Kotlin 1.7.10(错误表明它正在使用 1.6.0?),为什么它又尝试使用需要 1.8.0 的库?
\n编辑:
\n我应该说,在问这个问题之前,我确实尝试过 Stack 上与此相关的明显热门问题:
\n模块是使用不兼容的 Kotlin 版本编译的。其元数据的二进制版本是1.5.1,预期版本是1.1.15
\n我确实尝试了对此问题的最高评价(未接受)答案:
\n\n但这并没有解决我的问题。
\n我还想说这曾经有效(我从这里安装了所有先决条件,并且flutter doctor都是绿色勾号)
作为一名 Windows .Net 开发人员,我可能正在做一些真正的事情,并且我很欣赏 Flutter 包装了一个我完全不熟悉的工具链......但我真的很想了解为什么我遇到这个问题以及如何诊断它的解决方案......
\n另外,值得一提的是,尽管存在错误,它确实创建了 APK,而且奇怪的是,如果我使用调试构建 apk,那么我不会收到这些错误: …
在 intellij idea 16 EAP 144.3357.4 中,我有一个纯 Kotlin cmd 项目,目前拒绝运行此错误:
The binary version of its metadata is 1.0.1, expected version is 1.1.0
Run Code Online (Sandbox Code Playgroud)
该项目在命令行上运行 - 我使缓存无效并重新启动了 Idea - 没有任何帮助。任何人都遇到了同样的问题并找到了让它工作的方法?
说我花了大约 32 个小时还算轻描淡写。我一直在尝试在由 Expo SDK 44 提供支持的 React Native 项目中启用 Kotlin。
\n我一直在尝试在互联网上找到的所有方法,但总是在 EAS 的 Gradle 阶段出现错误(使用 运行它eas build --profile development --platform android)。
这是我的配置:
\n为了简洁起见,我省略了代码。如果您需要更多背景信息,请告诉我
\n应用程序\\android\\build.gradle:
\nbuildscript {\n ext {\n buildToolsVersion = "30.0.2"\n minSdkVersion = 21\n compileSdkVersion = 31\n targetSdkVersion = 31\n kotlinVersion = "1.4.11"\n }\n repositories {\n google()\n mavenCentral()\n jcenter()\n }\n dependencies {\n classpath("com.android.tools.build:gradle:4.1.0")\n classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")\n \n // NOTE: Do not place your application dependencies here; they belong\n // in the individual module build.gradle …Run Code Online (Sandbox Code Playgroud) 我连接了 firebase 并收到此错误,我该如何修复它?(类“com.google.firebase.auth.ktx.AuthKt”是使用不兼容版本的 Kotlin 编译的。其元数据的二进制版本是 1.7.1,预期版本是 1.5.1。)
buildscript {
ext {
compose_version = '1.1.0-beta01'
}
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud) kotlin ×8
android ×5
flutter ×3
gradle ×3
build.gradle ×2
expo ×1
firebase ×1
react-native ×1
version ×1