Search code examples
androidreact-nativekotlingradlereact-native-gesture-handler

Error while running React Native project on Android: A problem occurred evaluating project ':react-native-gesture-handler'


I am trying to run a React Native project on Android. I have imported the project from GitHub(https://github.com/Kaiwenkevinz/RandomChat.git) to my local machine, and I have proceeded to run the commands npm install and npx react-native run-android as instructed. However, I encountered an error during the npx react-native run-android process.

The specific error message I received is: enter image description here

I have tried researching this issue on various forums and documentation, but I haven't been able to find a solution that works for me. I believe this error might be related to the configuration or dependencies of the project.

Here's some additional information about my setup:

Operating System: Windows

React Native version: 9.6.7 (by npm react-native -v)

Node.js version: v18.17.1 (by node -v)

Android studio version: Android Studio Dolphin 2021.3.1 Patch 1

Project structrue: Android API 33

build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.3.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
    }
}

I think it's due to issues with the Gradle or Kotlin versions, which is causing the inability to run, but I haven't found a good solution yet.


Solution

  • try to add this klotin version and

    enter image description here

    and in your package.json verify if you've this version of
    "react-native-gesture-handler": "~2.8.0",

    I hope this may help.