React Native/React Native_error

[React Native - android] Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'.

bocoder
728x90
반응형

* kakao login 구현 시, android > build.gradle 파일의 buildscript에 kotlin 관련 설정 후 실행 시 발생한 에러

...
e: /Users/.../Desktop/Project/TeamSogon/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt: (22, 7): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. 
The binary version of its metadata is 1.5.1, expected version is 1.1.15.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s

    at makeError (/Users/.../node_modules/execa/index.js:174:9)
    at /Users/.../node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async runOnAllDevices (/Users/.../node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
    at async Command.handleAction (/Users/.../node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.

 

# 원인

compile 시에 kotlin 버전이 맞지 않아서 에러가 발생

 

# 해결

간단하게 android > build.gradle 파일에서 kotlin 버전만 변경하여 해결함

...
buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31
        
        // before
        // kotlinVersion = '1.3.41'

        // after
        kotlinVersion = '1.6.0'

...

 

 

* reference : https://stackoverflow.com/questions/67699823/module-was-compiled-with-an-incompatible-version-of-kotlin-the-binary-version-o

728x90
반응형