我遇到了Kotlin版本与React Native App的冲突

发布于 2025-02-06 18:51:21 字数 1939 浏览 1 评论 0原文

嗨,我是新手反应本地人,我有一个运行情况的应用程序还不错,今天工作正常,直到我试图删除node_modules package lock.json的某些功能崩溃,这给我带来了很长的错误再次运行该应用程序

npm run android

该错误基本上是这些以下行重复一遍又一遍地重复的

e: /home/abdelhamied/work/personal/ghaith-app/node_modules/react-native-navigation/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt: (76, 28): 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.16.
The class is loaded from /home/abdelhamied/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.30/d68efdea04955974ac1020f8f66ef8176bfbce1f/kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class

是我的build.gradle

buildscript {
    ext {
        RNNKotlinVersion = "1.3.61"
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
        classpath("com.android.tools.build:gradle:3.5.3")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

我试图更改Kotlin版本,因为我正在搜索将Internet从1.3.61扔到1.7.0但这给我带来了冲突的Kotlin版本错误,我需要做其他事情吗?

这在2个不同的设备(Linux/Windows)上发生了两次

hi I am new to react native, I have an app that was working pretty okay and today was working fine until I had a crash on some functionality I tried to remove node_modules package-lock.json and it got me very long error while trying to run the app again

npm run android

the error was basically these following lines repeated over and over again

e: /home/abdelhamied/work/personal/ghaith-app/node_modules/react-native-navigation/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt: (76, 28): 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.16.
The class is loaded from /home/abdelhamied/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.30/d68efdea04955974ac1020f8f66ef8176bfbce1f/kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class

here is my build.gradle

buildscript {
    ext {
        RNNKotlinVersion = "1.3.61"
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
        classpath("com.android.tools.build:gradle:3.5.3")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

I tried to change kotlin version as I was searching throw the internet from 1.3.61 to 1.7.0 but it gave me conflicting kotlin version error do i need to do anything else?

that happened twice on 2 different devices (linux/windows) its working fine unitl I reinstall the node_modules folder

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文