Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Android Kotlin version mismatch #4009

Closed
Mihai-github opened this issue Jul 15, 2024 · 4 comments · Fixed by #4018
Closed

[BUG]: Android Kotlin version mismatch #4009

Mihai-github opened this issue Jul 15, 2024 · 4 comments · Fixed by #4018

Comments

@Mihai-github
Copy link

Mihai-github commented Jul 15, 2024

Version

^6.4.1

What platforms are you having the problem on?

Android

System Version

React Native

On what device are you experiencing the issue?

Real device, Simulator

Architecture

Old architecture

What happened?

Task :react-native-video:compileReleaseKotlin FAILED
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: /Users/builder/.gradle/caches/transforms-3/113c75e423850f09a3a96afbb04140d6/transformed/jetified-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.7.1.
e: /Users/builder/.gradle/caches/transforms-3/113c75e423850f09a3a96afbb04140d6/transformed/jetified-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.7.1.
e: /Users/builder/.gradle/caches/transforms-3/113c75e423850f09a3a96afbb04140d6/transformed/jetified-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.7.1.
e: /Users/builder/.gradle/caches/transforms-3/46c2d7941a38979bf7d7f7ec3d090515/transformed/jetified-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.7.1.
e: /Users/builder/.gradle/caches/transforms-3/87bfc0762e08f5de7559bcbc54306d9d/transformed/jetified-okio-jvm-3.6.0.jar!/META-INF/okio.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.7.1.
e: /Users/builder/clone/node_modules/react-native-video/android/src/main/java/com/brentvatne/common/api/BufferConfig.kt: (40, 14): Class 'kotlin.jvm.JvmStatic' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/builder/.gradle/caches/transforms-3/113c75e423850f09a3a96afbb04140d6/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/jvm/JvmStatic.class
e: /Users/builder/clone/node_modules/react-native-video/android/src/main/java/com/brentvatne/common/api/BufferConfig.kt: (43, 22): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/builder/.gradle/caches/transforms-3/113c75e423850f09a3a96afbb04140d6/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
e: /Users/builder/clone/node_modules/react-native-video/android/src/main/java/com/brentvatne/common/api/BufferConfig.kt: (44, 22): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /Users/builder/.gradle/caches/transforms-3/113c75e423850f09a3a96afbb04140d6/transformed/jetified-kotlin-stdlib-1.9.10.jar!/kotlin/Unit.class
...
...
...

  • What went wrong:
    Execution failed for task ':react-native-video:compileReleaseKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction

Reproduction

Just trying to compile for release the application

@KrzysztofMoch
Copy link
Member

you can try

  • ./gradlew clean and try build again
  • or if it will not work - bump your kotlin version to 1.8 or 1.9

@KrzysztofMoch KrzysztofMoch changed the title [BUG]: [BUG]: Android Kotlin version mismatch Jul 15, 2024
@h-dung-95
Copy link

h-dung-95 commented Jul 15, 2024

I have the same problem, is there any way to solve it?
Error message: "Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1."

I used to RN 0.72.0

@KrzysztofMoch
Copy link
Member

@h-dung-95
try set compileSdkVersion & targetSdkVersion (in build.gradle) to 34 and kotlinVersion to 1.9.0

@Sk0057
Copy link

Sk0057 commented Jul 17, 2024

@KrzysztofMoch

try set compileSdkVersion & targetSdkVersion (in build.gradle) to 34 and kotlinVersion to 1.9.0

After setting these and also adding classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" statement inside dependencies in my build.gradle file, things are working fine for me now in my React Native(version 0.73.4) project
btw I am using react-native-video version ^6.3.0
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants