我的编程空间,编程开发者的网络收藏夹
学习永远不晚

【错误记录】Android Studio 中 Kotlin 版本报错 ( Module was compiled with an incompatible version of Kotlin. T )

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

【错误记录】Android Studio 中 Kotlin 版本报错 ( Module was compiled with an incompatible version of Kotlin. T )

文章目录





一、报错信息



在 Android Studio 中 , 编译应用 , 报如下错误 :

C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.0/7857e365f925cfa060f941c1357cda1f8790502c/kotlin-stdlib-common-1.6.0.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.6.0, expected version is 1.1.13.

在这里插入图片描述

这个报错问题 , 出现了十几次 ;

在这里插入图片描述

详细报错信息如下 : 下面的报错信息 , 仅做参考 , 就不要点开了 ;

> Task :app:compileDebugKotlin FAILEDw: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:    C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.jar (version 1.5)    C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.5.30/525f5a7fa6d7790a571c07dd24214ed2dda352fe/kotlin-stdlib-jdk7-1.5.30.jar (version 1.5)    C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar (version 1.6)    C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.0/7857e365f925cfa060f941c1357cda1f8790502c/kotlin-stdlib-common-1.6.0.jar (version 1.6)w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpathe: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errorse: C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.0/7857e365f925cfa060f941c1357cda1f8790502c/kotlin-stdlib-common-1.6.0.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.6.0, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.5.30/525f5a7fa6d7790a571c07dd24214ed2dda352fe/kotlin-stdlib-jdk7-1.5.30.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.5.1, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.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.5.1, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.Runtime JAR files in the classpath should have the same version. These files were found in the classpath:    C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.jar (version 1.5)    C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.5.30/525f5a7fa6d7790a571c07dd24214ed2dda352fe/kotlin-stdlib-jdk7-1.5.30.jar (version 1.5)    C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar (version 1.6)    C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.0/7857e365f925cfa060f941c1357cda1f8790502c/kotlin-stdlib-common-1.6.0.jar (version 1.6)e: C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-android/1.5.2/d246a704a55b7bddb79407cce4348890eaa341d9/kotlinx-coroutines-android-1.5.2.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.5.1, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.5.2/f4cc07a50437659e0043e7da762809a46932b6a0/kotlinx-coroutines-core-jvm-1.5.2.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.5.1, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/transforms-3/2d2e05a2754ff6e110d0373147158883/transformed/navigation-fragment-2.4.1-api.jar!/META-INF/navigation-fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/META-INF/navigation-runtime_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/transforms-3/98a12fce22bb35efa781271d8241e273/transformed/core-ktx-1.7.0-api.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.5.1, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/transforms-3/a30274fc0e0526fe1ef8c0b3cd696552/transformed/fragment-ktx-1.4.1-api.jar!/META-INF/fragment-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/transforms-3/b3e72646352669a2c158a12247e912da/transformed/slidingpanelayout-1.2.0-api.jar!/META-INF/slidingpanelayout_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/transforms-3/b812a08bf56bf9d544c39f2d2daffce7/transformed/navigation-ui-2.4.1-api.jar!/META-INF/navigation-ui_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/transforms-3/bbf2426cb1f6c0ebbc959e0eb199649d/transformed/fragment-1.4.1-api.jar!/META-INF/fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.13.e: C:/Users/octop/.gradle/caches/transforms-3/d12e05eecb6d4d83cbc249be744f1fb1/transformed/navigation-common-2.4.1-api.jar!/META-INF/navigation-common_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.e: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (9, 28): Class 'androidx.navigation.Navigation' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/Navigation.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (18, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (30, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (32, 16): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (34, 41): Unresolved reference: applye: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (36, 22): Unresolved reference: putStringe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (37, 22): Unresolved reference: putInte: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (41, 33): Class 'androidx.navigation.Navigation' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/Navigation.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (41, 44): Class 'androidx.navigation.NavController' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/NavController.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (43, 13): Class 'androidx.navigation.NavController' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/NavController.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentA.kt: (43, 27): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (10, 28): Class 'androidx.navigation.Navigation' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/Navigation.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (21, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.0/7857e365f925cfa060f941c1357cda1f8790502c/kotlin-stdlib-common-1.6.0.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.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (22, 20): Unresolved reference: lete: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (23, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (23, 20): Unresolved reference: ite: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (24, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (24, 19): Unresolved reference: ite: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (39, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (41, 16): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (48, 33): Class 'androidx.navigation.Navigation' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/Navigation.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (48, 44): Class 'androidx.navigation.NavController' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/NavController.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (50, 13): Class 'androidx.navigation.NavController' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/NavController.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\FragmentB.kt: (50, 27): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (5, 28): Class 'androidx.navigation.Navigation' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/Navigation.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (6, 31): Class 'androidx.navigation.ui.NavigationUI' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/b812a08bf56bf9d544c39f2d2daffce7/transformed/navigation-ui-2.4.1-api.jar!/androidx/navigation/ui/NavigationUI.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (10, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.5.30/525f5a7fa6d7790a571c07dd24214ed2dda352fe/kotlin-stdlib-jdk7-1.5.30.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.5.1, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (11, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (15, 29): Class 'androidx.navigation.NavController' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/NavController.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (16, 9): Class 'androidx.navigation.ui.NavigationUI' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/b812a08bf56bf9d544c39f2d2daffce7/transformed/navigation-ui-2.4.1-api.jar!/androidx/navigation/ui/NavigationUI.classC:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.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.5.1, expected version is 1.1.13.C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.e: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (16, 22): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-android/1.5.2/d246a704a55b7bddb79407cce4348890eaa341d9/kotlinx-coroutines-android-1.5.2.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.5.1, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (16, 22): Class 'androidx.navigation.NavController' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.5.2/f4cc07a50437659e0043e7da762809a46932b6a0/kotlinx-coroutines-core-jvm-1.5.2.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.5.1, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/NavController.classC:/Users/octop/.gradle/caches/transforms-3/2d2e05a2754ff6e110d0373147158883/transformed/navigation-fragment-2.4.1-api.jar!/META-INF/navigation-fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.e: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (16, 22): Class 'androidx.navigation.ui.AppBarConfiguration' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/META-INF/navigation-runtime_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/transforms-3/98a12fce22bb35efa781271d8241e273/transformed/core-ktx-1.7.0-api.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.5.1, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/b812a08bf56bf9d544c39f2d2daffce7/transformed/navigation-ui-2.4.1-api.jar!/androidx/navigation/ui/AppBarConfiguration.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (16, 60): Class 'androidx.navigation.NavController' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/transforms-3/a30274fc0e0526fe1ef8c0b3cd696552/transformed/fragment-ktx-1.4.1-api.jar!/META-INF/fragment-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.13.The class is loaded from C:/Users/octop/.gradle/caches/transforms-3/7c8d0ea965780acf266bbf51684cf083/transformed/navigation-runtime-2.4.1-api.jar!/androidx/navigation/NavController.classC:/Users/octop/.gradle/caches/transforms-3/b3e72646352669a2c158a12247e912da/transformed/slidingpanelayout-1.2.0-api.jar!/META-INF/slidingpanelayout_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/transforms-3/b812a08bf56bf9d544c39f2d2daffce7/transformed/navigation-ui-2.4.1-api.jar!/META-INF/navigation-ui_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.C:/Users/octop/.gradle/caches/transforms-3/bbf2426cb1f6c0ebbc959e0eb199649d/transformed/fragment-1.4.1-api.jar!/META-INF/fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.13.C:/Users/octop/.gradle/caches/transforms-3/d12e05eecb6d4d83cbc249be744f1fb1/transformed/navigation-common-2.4.1-api.jar!/META-INF/navigation-common_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.




二、问题分析



核心报错信息如下 :

Module was compiled with an incompatible version of Kotlin.
The binary version of its metadata is 1.6.0, expected version is 1.1.13.


大概含义就是用错了 Kotlin 语言的版本 ;

模块是用不兼容的Kotlin版本编译的。
其元数据的二进制版本为1.6.0,预期版本为1.1.13。


再查看一个具体的错误 :

The class is loaded from C:/Users/octop/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar!/kotlin/Unit.classe: D:\002_Project\002_Android_Learn\Navigation\app\class="lazy" data-src\main\java\kim\hsl\nav\MainActivity.kt: (5, 28): Class 'androidx.navigation.Navigation' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.

分析上述错误 :

Class ‘androidx.navigation.Navigation’ was compiled with an incompatible version of Kotlin.
The binary version of its metadata is 1.6.0, expected version is 1.1.13.

类的androidx.navigation。“导航”是用不兼容的Kotlin版本编译的。
其元数据的二进制版本为1.6.0,预期版本为1.1.13。


该 Android 项目中调用了 androidx.navigation.Navigation 库 , 该库使用的 Kotlin 版本是 1.6.0 , 你用的 Kotlin 版本只能 高于该 Kotlin 版本 ;





三、解决方案



在 编译依赖 中 , 添加 Kotlin 语言 Gradle 插件 , 高于 上面报错提示的 1.6.0 版本即可 ;

classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20'

1、低版本 Gradle 配置


如果使用的是 低版本的 Gradle 进行构建 , 则是在 根目录下的 buildscript / dependencies 中添加 如下依赖 ;

classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20'

添加后的完整代码如下 :

buildscript {    repositories {        google()        mavenCentral()        jcenter()        maven {            url 'https://maven.aliyun.com/repository/public/'        }        maven{            url 'https://maven.aliyun.com/repository/google/'        }    }    dependencies {        classpath "com.android.tools.build:gradle:7.3.1"        classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0-alpha06'        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}

2、高版本 Gradle 配置


如果你当前使用的是 高版本的 Gradle 构建工具 , 那么需要在 根目录下的 build.gradle 中的 plugins 中添加

id 'org.jetbrains.kotlin.android' version '1.7.20' apply false

插件的依赖 ;

完整的代码如下 :

// Top-level build file where you can add configuration options common to all sub-projects/modules.plugins {    id 'com.android.application' version '7.3.1' apply false    id 'com.android.library' version '7.3.1' apply false    id 'org.jetbrains.kotlin.android' version '1.7.20' apply false    id 'androidx.navigation.safeargs' version '2.3.0-alpha06' apply false}

对应的 Maven 库配置在 settings.gradle 构建脚本中 , 代码如下 :

pluginManagement {    repositories {        gradlePluginPortal()        google()        mavenCentral()        jcenter()        maven {            url 'https://maven.aliyun.com/repository/public/'        }        maven{            url 'https://maven.aliyun.com/repository/google/'        }    }}

这里建议把 jcenter 和 阿里云的源都配置进去 , 多配置一些 , 总不会出错 ;

来源地址:https://blog.csdn.net/han1202012/article/details/132479852

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

【错误记录】Android Studio 中 Kotlin 版本报错 ( Module was compiled with an incompatible version of Kotlin. T )

下载Word文档到电脑,方便收藏和打印~

下载Word文档

编程热搜

  • Android:VolumeShaper
    VolumeShaper(支持版本改一下,minsdkversion:26,android8.0(api26)进一步学习对声音的编辑,可以让音频的声音有变化的播放 VolumeShaper.Configuration的三个参数 durati
    Android:VolumeShaper
  • Android崩溃异常捕获方法
    开发中最让人头疼的是应用突然爆炸,然后跳回到桌面。而且我们常常不知道这种状况会何时出现,在应用调试阶段还好,还可以通过调试工具的日志查看错误出现在哪里。但平时使用的时候给你闹崩溃,那你就欲哭无泪了。 那么今天主要讲一下如何去捕捉系统出现的U
    Android崩溃异常捕获方法
  • android开发教程之获取power_profile.xml文件的方法(android运行时能耗值)
    系统的设置–>电池–>使用情况中,统计的能耗的使用情况也是以power_profile.xml的value作为基础参数的1、我的手机中power_profile.xml的内容: HTC t328w代码如下:
    android开发教程之获取power_profile.xml文件的方法(android运行时能耗值)
  • Android SQLite数据库基本操作方法
    程序的最主要的功能在于对数据进行操作,通过对数据进行操作来实现某个功能。而数据库就是很重要的一个方面的,Android中内置了小巧轻便,功能却很强的一个数据库–SQLite数据库。那么就来看一下在Android程序中怎么去操作SQLite数
    Android SQLite数据库基本操作方法
  • ubuntu21.04怎么创建桌面快捷图标?ubuntu软件放到桌面的技巧
    工作的时候为了方便直接打开编辑文件,一些常用的软件或者文件我们会放在桌面,但是在ubuntu20.04下直接直接拖拽文件到桌面根本没有效果,在进入桌面后发现软件列表中的软件只能收藏到面板,无法复制到桌面使用,不知道为什么会这样,似乎并不是很
    ubuntu21.04怎么创建桌面快捷图标?ubuntu软件放到桌面的技巧
  • android获取当前手机号示例程序
    代码如下: public String getLocalNumber() { TelephonyManager tManager =
    android获取当前手机号示例程序
  • Android音视频开发(三)TextureView
    简介 TextureView与SurfaceView类似,可用于显示视频或OpenGL场景。 与SurfaceView的区别 SurfaceView不能使用变换和缩放等操作,不能叠加(Overlay)两个SurfaceView。 Textu
    Android音视频开发(三)TextureView
  • android获取屏幕高度和宽度的实现方法
    本文实例讲述了android获取屏幕高度和宽度的实现方法。分享给大家供大家参考。具体分析如下: 我们需要获取Android手机或Pad的屏幕的物理尺寸,以便于界面的设计或是其他功能的实现。下面就介绍讲一讲如何获取屏幕的物理尺寸 下面的代码即
    android获取屏幕高度和宽度的实现方法
  • Android自定义popupwindow实例代码
    先来看看效果图:一、布局
  • Android第一次实验
    一、实验原理 1.1实验目标 编程实现用户名与密码的存储与调用。 1.2实验要求 设计用户登录界面、登录成功界面、用户注册界面,用户注册时,将其用户名、密码保存到SharedPreference中,登录时输入用户名、密码,读取SharedP
    Android第一次实验

目录