一、报错信息
在 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 FAILED
w: 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 classpath
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: 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\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\src\main\java\kim\hsl\nav\FragmentA.kt: (34, 41): Unresolved reference: apply
e: D:\002_Project\002_Android_Learn\Navigation\app\src\main\java\kim\hsl\nav\FragmentA.kt: (36, 22): Unresolved reference: putString
e: D:\002_Project\002_Android_Learn\Navigation\app\src\main\java\kim\hsl\nav\FragmentA.kt: (37, 22): Unresolved reference: putInt
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\src\main\java\kim\hsl\nav\FragmentB.kt: (22, 20): Unresolved reference: let
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\src\main\java\kim\hsl\nav\FragmentB.kt: (23, 20): Unresolved reference: it
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\src\main\java\kim\hsl\nav\FragmentB.kt: (24, 19): Unresolved reference: it
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
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.
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\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
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: D:\002_Project\002_Android_Learn\Navigation\app\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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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.class
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.
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.class
e: D:\002_Project\002_Android_Learn\Navigation\app\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 构建脚本中 , 代码如下 :文章来源:https://www.toymoban.com/news/detail-742790.html
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
jcenter()
maven {
url 'https://maven.aliyun.com/repository/public/'
}
maven{
url 'https://maven.aliyun.com/repository/google/'
}
}
}
这里建议把 jcenter 和 阿里云的源都配置进去 , 多配置一些 , 总不会出错 ;文章来源地址https://www.toymoban.com/news/detail-742790.html
到了这里,关于【错误记录】Android Studio 中 Kotlin 版本报错 ( Module was compiled with an incompatible version of Kotlin. T )的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!