androidreact-nativereact-native-gesture-handler

React Native - Error with react native gesture handler


I'm trying to build my react native app but I got the following error in android:

Execution failed for task ':react-native-gesture-handler:compileDebugKotlin

My dependencies are:

"dependencies": {
        "@dynatrace/react-native-plugin": "^2.305.1",
        "@notifee/react-native": "^7.8.2",
        "@react-native-async-storage/async-storage": "^1.23.1",
        "@react-native-community/netinfo": "^11.3.1",
        "@react-native-cookies/cookies": "^6.2.1",
        "@react-native-firebase/analytics": "^20.0.0",
        "@react-native-firebase/app": "^20.0.0",
        "@react-native-firebase/messaging": "^20.0.0",
        "@react-native-firebase/remote-config": "^20.0.0",
        "@react-native/gradle-plugin": "^0.76.3",
        "@react-navigation/bottom-tabs": "^6.6.1",
        "@react-navigation/material-top-tabs": "^6.6.14",
        "@react-navigation/native": "^6.1.18",
        "@react-navigation/stack": "^6.4.1",
        "@reduxjs/toolkit": "^1.9.5",
        "@shopify/restyle": "^1.3.0",
        "@types/clone": "^2.1.1",
        "@types/react-redux": "^7.1.9",
        "axios": "^1.4.0",
        "better-docs": "^2.7.2",
        "clone": "^2.1.2",
        "compare-versions": "^6.1.0",
        "husky": "^9.1.3",
        "identity-obj-proxy": "^3.0.0",
        "lint-staged": "^15.0.2",
        "moment": "^2.29.1",
        "react": "^18.2.0",
        "react-dom": "^18.0.0",
        "react-native": "^0.71.18",
        "react-native-adjust": "^4.35.1",
        "react-native-base64": "^0.2.1",
        "react-native-blob-util": "0.19.4",
        "react-native-bootsplash": "^4.3.3",
        "react-native-contacts": "^7.0.4",
        "react-native-crypto-js": "^1.0.0",
        "react-native-device-info": "^11.1.0",
        "react-native-elements": "^2.3.2",
        "react-native-exit-app": "^1.1.0",
        "react-native-fast-image": "^8.3.2",
        "react-native-fs": "^2.20.0",
        "react-native-geolocation-service": "^5.3.1",
        "react-native-gesture-bottom-sheet": "^1.0.9",
        "react-native-gesture-handler": "^2.9.0",
        "react-native-gradle-plugin": "^0.71.19",
        "react-native-hash": "^3.0.3",
        "react-native-image-helper": "0.0.3",
        "react-native-inappbrowser-reborn": "^3.7.0",
        "react-native-offline": "^6.0.2",
        "react-native-popup-menu": "^0.16.1",
        "react-native-public-ip": "^1.0.2",
        "react-native-reanimated": "3.12.0",
        "react-native-redash": "^18.1.3",
        "react-native-safe-area-context": "^3.1.8",
        "react-native-screens": "^2.11.0",
        "react-native-share": "^11.0.3",
        "react-native-size-matters": "^0.4.0",
        "react-native-splash-screen": "^3.2.0",
        "react-native-store-review": "^0.4.3",
        "react-native-svg": "15.3.0",
        "react-native-swrve-plugin": "5.0.0",
        "react-native-system-setting": "^1.7.6",
        "react-native-vector-icons": "^10.1.0",
        "react-native-webview": "^13.8.6",
        "react-redux": "^8.1.2",
        "redux": "^4.0.5",
        "redux-saga": "^1.1.3"
    },
    "devDependencies": {
        "@babel/cli": "^7.24.1",
        "@babel/core": "^7.24.4",
        "@babel/preset-env": "^7.24.4",
        "@babel/runtime": "^7.24.4",
        "@react-native-community/eslint-config": "^3.2.0",
        "@redux-saga/types": "^1.1.0",
        "@testing-library/react-native": "^12.5.0",
        "@tsconfig/react-native": "^3.0.5",
        "@types/enzyme": "^3.10.14",
        "@types/enzyme-adapter-react-16": "1.0.6",
        "@types/jest": "^29.5.5",
        "@types/react": "^18.0.24",
        "@types/react-dom": "^18.0.0",
        "@types/react-native": "^0.71.13",
        "@types/react-native-base64": "^0.2.2",
        "@types/react-test-renderer": "^18.0.2",
        "@typescript-eslint/eslint-plugin": "^6.7.3",
        "@typescript-eslint/parser": "^6.7.3",
        "babel-jest": "^29.7.0",
        "enzyme": "^3.11.0",
        "enzyme-adapter-react-16": "^1.15.6",
        "enzyme-to-json": "^3.6.1",
        "eslint": "^8.19.0",
        "jest": "^29.7.0",
        "jest-environment-enzyme": "^7.1.2",
        "jest-enzyme": "^7.1.2",
        "jsdoc": "^4.0.2",
        "metro-react-native-babel-preset": "^0.73.10",
        "react-native-svg-transformer": "^1.0.0",
        "react-test-renderer": "^18.2.0",
        "reactotron-react-native": "5.0.0",
        "reactotron-redux": "3.1.3",
        "reactotron-redux-saga": "4.2.3",
        "redux-devtools-extension": "^2.13.8",
        "typescript": "^5.2.2"
    },

My android/build.gradle is:

buildscript {
apply from: "../node_modules/@dynatrace/react-native-plugin/files/plugin.gradle", to: buildscript
    ext {
        minSdkVersion = 23
        buildToolsVersion = "33.0.0"
        compileSdkVersion = 34
        targetSdkVersion = 34
        kotlinVersion = "1.6.0"

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"

        androidXAnnotation = "1.2.0"
        androidXBrowser = "1.3.0"
    }
    repositories {
        google()
        mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }
    dependencies {
        classpath('com.android.tools.build:gradle:8.7.2')
        classpath 'com.google.gms:google-services:4.4.1'
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply from: "../node_modules/@dynatrace/react-native-plugin/files/dynatrace.gradle"

I tried the following, in my package.json I removed the "^" in the line below:

"react-native-gesture-handler": "^2.9.0"

With that change my app is built successfully, BUT my app has a strange behavior, it has navigation problems.

Any idea of how to solve this without removing the "^"? Until last week my app worked perfectly fine, and one day I begin to experiment this behavior.


Solution

  • I managed to solve it using the following libraries versions in my package.json:

    "react-native-gesture-handler": "2.21.2",
    "react-native-webview": "13.12.5",
    

    Without the ^, in order to install those specific library versions.