react-native-gesture-handler: Task :react-native-gesture-handler:compileDebugKotlin FAILED

Description

image image

Dependencies:

  "dependencies": {
    "expo": "~47.0.12",
    "expo-status-bar": "~1.4.2",
    "react": "18.1.0",
    "react-native": "0.70.5",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-reanimated": "^2.14.4",
    "expo-splash-screen": "~0.17.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },

run in MacOS, m1

Steps to reproduce

What I’ve done:

  1. create a new project and run expo prebuild

  2. Install those dependencies(RNGH, react-native-reanimated) with yarn add

  3. Enable new arch by adding "jsEngine": "hermes" to app.json,

  4. In gradle.properties I changed: newArchEnabled=true and expo.jsEngine=hermes

  5. In android/app/build.gradle: def enableHermes = project.ext.react.get("enableHermes", true);

  6. Then I run cd android/ && ./gradlew clean

  7. While I run npx expo run:android, errors occurred as in the screenshots.

Snack or a link to a repository

https://github.com/inmess/rngh-bug-repo.git

Gesture Handler version

2.9.0

React Native version

0.70.5

Platforms

Android

JavaScript runtime

Hermes

Workflow

Expo bare workflow

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Real device

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 17
  • Comments: 42 (1 by maintainers)

Most upvoted comments

updating my android build.gradle buildscript to

buildscript {
    ext {
        buildToolsVersion = '33.0.0'
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
  }
....
}

as stated here https://stackoverflow.com/a/76409767/8523267 worked for me

same issue with RN version 0.71.4

Similar issue but slight different

‘boost/mpl/count.hpp’ file not found

`FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong: Execution failed for task ‘:react-native-gesture-handler:buildCMakeDebug[arm64-v8a]’.

com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/xxxxxxxxxxx/Documents/project/xxxxxx/xxxxxx.xxxxxxxxx/node_modules/react-native-gesture-handler/android/.cxx/Debug/w6d2y2f2/arm64-v8a’ [1/2] Building CXX object CMakeFiles/gesturehandler.dir/cpp-adapter.cpp.o FAILED: CMakeFiles/gesturehandler.dir/cpp-adapter.cpp.o /Users/xxxxxxxxxxx/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/Users/xxxxxxxxxxx/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dgesturehandler_EXPORTS -isystem /Users/xxxxxxxxxxx/.gradle/caches/transforms-3/a907c5f55cb4cb0ae8ad3aa0f22077df/transformed/jetified-react-android-0.71.4-debug/prefab/modules/react_render_core/include -isystem /Users/xxxxxxxxxxx/.gradle/caches/transforms-3/a907c5f55cb4cb0ae8ad3aa0f22077df/transformed/jetified-react-android-0.71.4-debug/prefab/modules/react_render_uimanager/include -isystem /Users/xxxxxxxxxxx/.gradle/caches/transforms-3/a907c5f55cb4cb0ae8ad3aa0f22077df/transformed/jetified-react-android-0.71.4-debug/prefab/modules/jsi/include -isystem /Users/xxxxxxxxxxx/.gradle/caches/transforms-3/a907c5f55cb4cb0ae8ad3aa0f22077df/transformed/jetified-react-android-0.71.4-debug/prefab/modules/react_nativemodule_core/include -O2 -frtti -fexceptions -Wall -Werror -std=c++17 -g -fno-limit-debug-info -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -MD -MT CMakeFiles/gesturehandler.dir/cpp-adapter.cpp.o -MF CMakeFiles/gesturehandler.dir/cpp-adapter.cpp.o.d -o CMakeFiles/gesturehandler.dir/cpp-adapter.cpp.o -c /Users/xxxxxxxxxxx/Documents/project/xxxxxx/xxxxxx.xxxxxxxxx/node_modules/react-native-gesture-handler/android/src/main/jni/cpp-adapter.cpp In file included from /Users/xxxxxxxxxxx/Documents/project/xxxxxx/xxxxxx.xxxxxxxxx/node_modules/react-native-gesture-handler/android/src/main/jni/cpp-adapter.cpp:4: In file included from /Users/xxxxxxxxxxx/.gradle/caches/transforms-3/a907c5f55cb4cb0ae8ad3aa0f22077df/transformed/jetified-react-android-0.71.4-debug/prefab/modules/react_render_uimanager/include/react/renderer/uimanager/primitives.h:15: In file included from /Users/xxxxxxxxxxx/.gradle/caches/transforms-3/a907c5f55cb4cb0ae8ad3aa0f22077df/transformed/jetified-react-android-0.71.4-debug/prefab/modules/react_render_core/include/react/renderer/core/ShadowNode.h:14: In file included from /Users/xxxxxxxxxxx/.gradle/caches/transforms-3/a907c5f55cb4cb0ae8ad3aa0f22077df/transformed/jetified-react-android-0.71.4-debug/prefab/modules/react_nativemodule_core/include/butter/small_vector.h:15: /Users/xxxxxxxxxxx/.gradle/caches/transforms-3/a907c5f55cb4cb0ae8ad3aa0f22077df/transformed/jetified-react-android-0.71.4-debug/prefab/modules/react_nativemodule_core/include/folly/small_vector.h:35:10: fatal error: ‘boost/mpl/count.hpp’ file not found #include <boost/mpl/count.hpp> ^~~~~~~~~~~~~~~~~~~~~ 1 error generated. ninja: build stopped: subcommand failed.

C++ build system [build] failed while executing: /Users/xxxxxxxxxxx/Library/Android/sdk/cmake/3.22.1/bin/ninja
-C
/Users/xxxxxxxxxxx/Documents/project/xxxxxx/xxxxxx.xxxxxxxxx/node_modules/react-native-gesture-handler/android/.cxx/Debug/w6d2y2f2/arm64-v8a
gesturehandler from /Users/xxxxxxxxxxx/Documents/project/xxxxxx/xxxxxx.xxxxxxxxx/node_modules/react-native-gesture-handler/android

  • 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. ==============================================================================

2: Task failed with an exception.

  • What went wrong: java.lang.StackOverflowError (no error message)`

Error message: Execution failed for task ‘:react-native-gesture-handler:compileDebugKotlin’.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details

Root cause: Version incompatibility between React Native 0.73.0 and react-native-gesture-handler 2.14.0. React Native 0.73.x introduced new Android toolchain requirements (Android Gradle Plugin 8.1.x, Java 17, stricter Kotlin versions) that older gesture handler versions don’t support.

Solution: npm install react-native-gesture-handler@2.18.1 cd android && ./gradlew clean && cd … npx react-native run-android

IMPORTANT:: Remove ^ and ~ if there with 2.18.1 in package.json

Compatibility graph react-native-gesture-handler 2.26.0+ → React Native 0.78.0+ react-native-gesture-handler 2.25.0+ → React Native 0.76.0+ react-native-gesture-handler 2.24.0+ → React Native 0.75.0+ react-native-gesture-handler 2.21.0+ → React Native 0.74.0+ react-native-gesture-handler 2.18.0+ → React Native 0.73.0+ react-native-gesture-handler 2.16.0+ → React Native 0.68.0+ react-native-gesture-handler 2.14.0+ → React Native 0.67.0+ react-native-gesture-handler 2.10.0+ → React Native 0.64.0+ react-native-gesture-handler 2.0.0+ → React Native 0.63.0+

Downgraded Android Gradle Plugin: 7.3.1 (downgraded due to experiencing another issue with AGP 7.4.1 https://issuetracker.google.com/issues/232060576)

classpath("com.android.tools.build:gradle:7.3.1") looks resolve issue, but idk reasons how

gradle 7.4.1 as suggested for expo modules config cause the issue for me

Guys, just take this char ^ away. End result: “react-native-gesture-handler”: “2.9.0”

android > build.gradle and replace by ndkVersion = "25.2.9519653"

Same issue here with RN 0.71.3 and RNGH 2.9.0 .gradle/caches/transforms-3/3b4066e6a8ae874968e4742fedafe30a/transformed/jetified-react-android-0.71.3-debug/prefab/modules/react_nativemodule_core/include/folly/small_vector.h:35:10: fatal error: 'boost/mpl/count.hpp' file not found

same issue and solutions doesnt work !

can you try add this line at android/build.gradle file

dependencies {
     ...
    classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
}

do not forget to clean gradlew.

Same issue: fatal error: 'boost/mpl/count.hpp' file not found

Versions: React Native @ 0.71.5 (Nothing changes when I downgraded React Native to 0.71.0) RN Gesture Handler @ 2.9.0 Reanimated @ 3.0.2

Enviroment: MacBook Pro M1 Pro @ 13.2.1

Would love to hear any potential solutions anyone has come up with… I can’t seem to find any info regarding this issue specifically anywhere online, sadly.

classpath("com.android.tools.build:gradle:7.3.1") looks resolve issue, but idk reasons how

An alternative workaround to the problems has been found: upgrade NDK: ndkVersion = “25.0.8775105”

same issue

same issue on RN 0.72.0-rc3 and RN gesture handler 2.10.1, M1 MacOS 13.3. Any solution?

I have fixed this error

error is

e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:619:30 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:619:44 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:619:58 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:619:74 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:622:25 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:622:45 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:623:19 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:625:19 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:627:19 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
e: file:///Users/xxx/Documents/Project/rnApp/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt:629:19 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.swmansion.gesturehandler.core.GestureHandler<*>?'.
private val handlersComparator = Comparator<GestureHandler<*>?> { a, b ->
      return@Comparator if (a!=null && a.isActive && b!!.isActive || a!=null && a.isAwaiting && b!!.isAwaiting) {
        // both A and B are either active or awaiting activation, in which case we prefer one that
        // has activated (or turned into "awaiting" state) earlier
        Integer.signum(b.activationIndex - a.activationIndex)
      } else if (a!=null &&a.isActive) {
        -1 // only A is active
      } else if (b!=null && b.isActive) {
        1 // only B is active
      } else if (a!=null &&a.isAwaiting) {
        -1 // only A is awaiting, B is inactive
      } else if (b!=null && b.isAwaiting) {
        1 // only B is awaiting, A is inactive
      } else {
        0 // both A and B are inactive, stable order matters
      }
    }

I managed to fix this problem by going to the gradle.properties of the library and changing this line

RNGH_kotlinVersion=1.6.21

to match my project’s kotlin version which was 1.6.0

same issue on RN 0.70.1 and RN gesture handler 2.10.1, MacOS 13.3. Any solution?

Getting the same issue with the following versions: React Native: 0.71.5 react-native-gesture-handler: 2.9.0

The error: Execution failed for task ':react-native-gesture-handler:configureCMakeRelWithDebInfo[arm64-v8a]'.

Just download the gesture handler git and build the FabricExample work fine first the problem happened when newArchEnabled=true if i change from react native version 0.71.4 to 0.71.0 my project compile properly

Guys, just take this char ^ away. End result: “react-native-gesture-handler”: “2.9.0”

thank, it worked for me. Can you explain why?

Downgraded Android Gradle Plugin: 7.3.1 (downgraded due to experiencing another issue with AGP 7.4.1 https://issuetracker.google.com/issues/232060576)

classpath("com.android.tools.build:gradle:7.3.1") looks resolve issue, but idk reasons how

gradle 7.4.1 as suggested for expo modules config cause the issue for me

it worked for me. update file build.gradle. and set gradle version to 7.3.1 —classpath(“com.android.tools.build:gradle:7.3.1”)

Same Android build issue: fatal error: 'boost/mpl/count.hpp' file not found

RN: 0.71.3 w/ new architecture react-native-gesture-handler: 2.9.0 react-native-reanimated: 3.0.2 Gradle Wrapper: 7.5.1 Android Gradle Plugin: 7.4.1

Update:

Upgraded RN to 0.71.6 Downgraded Android Gradle Plugin: 7.3.1 (downgraded due to experiencing another issue with AGP 7.4.1 https://issuetracker.google.com/issues/232060576)

Not sure if it was the AGP downgrade or RN upgrade but now the react-native-gesture-handler build error is gone.

same problem here (expo 48, RN 0.71.4, newArch, reanimated3), maybe related to something like https://github.com/expo/expo/issues/20679