react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

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

Open inmess opened this issue 1 year ago • 36 comments

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

inmess avatar Feb 28 '23 07:02 inmess

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Steps to reproduce section.

github-actions[bot] avatar Feb 28 '23 07:02 github-actions[bot]

More Information of error

FAILURE: Build completed with 3 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-gesture-handler:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using /Volumes/T7/Documents/test-app/node_modules/react-native-gesture-handler/android/src/main/jni/CMakeLists.txt: Build command failed.
  Error while executing process /Users/gabrielcheng/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H/Volumes/T7/Documents/test-app/node_modules/react-native-gesture-handler/android/src/main/jni -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_PLATFORM=android-21 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=/Users/gabrielcheng/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_ANDROID_NDK=/Users/gabrielcheng/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=/Users/gabrielcheng/Library/Android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/gabrielcheng/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_CXX_FLAGS=-O2 -frtti -fexceptions -Wall -Werror -std=c++17 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Volumes/T7/Documents/test-app/node_modules/react-native-gesture-handler/android/build/intermediates/cxx/Debug/1s575c3k/obj/arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Volumes/T7/Documents/test-app/node_modules/react-native-gesture-handler/android/build/intermediates/cxx/Debug/1s575c3k/obj/arm64-v8a -DCMAKE_BUILD_TYPE=Debug -B/Volumes/T7/Documents/test-app/node_modules/react-native-gesture-handler/android/.cxx/Debug/1s575c3k/arm64-v8a -GNinja -DAPP_BUILD_DIR=/Volumes/T7/Documents/test-app/android/app/build -DREACT_NATIVE_DIR=/Volumes/T7/Documents/test-app/node_modules/react-native -DANDROID_STL=c++_shared}
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Users/gabrielcheng/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Users/gabrielcheng/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring incomplete, errors occurred!
  See also "/Volumes/T7/Documents/test-app/node_modules/react-native-gesture-handler/android/.cxx/Debug/1s575c3k/arm64-v8a/CMakeFiles/CMakeOutput.log".

  CMake Error at CMakeLists.txt:9 (include):
    include could not find load file:

      /Volumes/T7/Documents/test-app/node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake


  CMake Error at CMakeLists.txt:17 (find_package):
    Could not find a package configuration file provided by "ReactAndroid" with
    any of the following names:

      ReactAndroidConfig.cmake
      reactandroid-config.cmake

    Add the installation prefix of "ReactAndroid" to CMAKE_PREFIX_PATH or set
    "ReactAndroid_DIR" to a directory containing one of the above files.  If
    "ReactAndroid" provides a separate development package or SDK, be sure it
    has been installed.

inmess avatar Feb 28 '23 07:02 inmess

same issue

student513 avatar Mar 10 '23 16:03 student513

same issue with RN version 0.71.4

devgunatwork avatar Mar 16 '23 11:03 devgunatwork

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)`

cisiwen avatar Mar 22 '23 07:03 cisiwen

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

cisiwen avatar Mar 22 '23 09:03 cisiwen

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

NSShentu avatar Mar 23 '23 03:03 NSShentu

Same issue: fatal error: 'boost/mpl/count.hpp' file not found [email protected] [email protected]

AliMSbaee avatar Mar 23 '23 21:03 AliMSbaee

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

achorein avatar Mar 27 '23 07:03 achorein

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.

natehurley avatar Mar 29 '23 22:03 natehurley

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]'.

Makar8000 avatar Mar 30 '23 20:03 Makar8000

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.

beeboopx avatar Apr 07 '23 17:04 beeboopx

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

Bort-777 avatar Apr 11 '23 19:04 Bort-777

Same issues occur to me as well after enableNewArch=true. for RN: 0.71.6 RNGH: 2.9.0

.gradle/caches/transforms-3/1d77430c69ac7afa83726261db6d41b1/transformed/jetified-react-android-0.71.6-release/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>

kaushal9808 avatar Apr 14 '23 16:04 kaushal9808

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")

cycweeds avatar Apr 22 '23 17:04 cycweeds

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"

Bort-777 avatar Apr 28 '23 15:04 Bort-777

On React Native 0.72 release candidates, this seems to happen out of the box now with Fabric (probably because 0.72 stopped pinning the Android Gradle Plugin (AGP) to 7.3.1). Simple way to replicate the error:

  • Create a new 0.72.rc3 app: npx react-native@latest init RN0720RC3 --version 0.72.0-rc.3
  • Add react-native-gesture-handler: cd RN0720RC3; npm i react-native-gesture-handler
  • Set newArchEnabled=true in android/settings.gradle
  • Run the app: npx react-native run-android --deviceId YOUR_DEVICE_ID (verified on real device with id from adb devices; not tried on emulator)

In React Native 0.72, (or if you need AGP 7.4.2 for some other reason e.g. requirement of some native module), the best workaround is for now probably updating NDK as @Bort-777 suggests (ndkVersion = "25.0.8775105" in android/build.gradle replacing the existing ndk version). In React Native 0.71, I found classpath("com.android.tools.build:gradle:7.3.1") seemed more effective. May vary by app.

AlanSl avatar May 15 '23 08:05 AlanSl

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

emclab avatar May 27 '23 04:05 emclab

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

Miyo-Excellent avatar May 31 '23 01:05 Miyo-Excellent

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

Dverybest avatar Jun 08 '23 11:06 Dverybest

same issue with

  • RN 0.72.0-rc.5
  • Expo 49,49.0.0-alpha.3
  • Reanimated: 3.3.0
  • newArchEnabled=true

thanhloc-17 avatar Jun 12 '23 03:06 thanhloc-17

same issue .

SahilJarial avatar Jun 23 '23 07:06 SahilJarial

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

MihailsKostjuks avatar Jun 26 '23 15:06 MihailsKostjuks

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

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

dnk332 avatar Jul 03 '23 03:07 dnk332

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

mdarifulislamroni521 avatar Jul 28 '23 05:07 mdarifulislamroni521

hi i did all this steps mentioned above: 1- buildscript { ext { buildToolsVersion = '33.0.0' minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 } .... } 2- com.android.tools.build:gradle:7.3.1 3- android > build.gradle and replace by ndkVersion = "25.2.9519653" and the errors gone thanks to others i hope this helped

mahshid22 avatar Jul 30 '23 10:07 mahshid22

如果你绝望了,上面的方法都不行的话,你最后试试把android > gradle.properties下的newArchEnabled改成false,就离谱,我试了几天终于发现这个玩意老坑了,原因是 使用此属性可以启用对新体系结构的支持。这将允许您在应用程序中使用TurboModules和Fabric渲染。如果您想编写自定义TurboModule/Fabric组件或使用提供这些组件的库,则应启用此标志。

nubwang avatar Aug 16 '23 07:08 nubwang

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

what's your android targetsdk version?

Yandamuri avatar Aug 20 '23 11:08 Yandamuri

While facing compilation issues in the React Native project, I identified that the error was related to the NDK and SDK configurations within Gradle. I resolved the issue by adjusting the versions in the Gradle configuration file as follows:

ndkVersion = "25.0.8775105"

buildscript {
  ext {
    targetSdkVersion  '33.0.0'
    buildToolsVersion = 33
    compileSdkVersion = 33
  }
}

This change fixed the compilation errors related to :react-native-gesture-handler:compileDebugKotlin and java.lang.StackOverflowError, allowing the build to complete successfully. This solution may be helpful for other developers facing similar issues with these specific versions of the NDK and SDK.

CarlosDanielDev avatar Aug 23 '23 18:08 CarlosDanielDev

Adding following property to gradle.properties file is worked for me.

kotlin.jvm.target.validation.mode=error

vnknt avatar Sep 10 '23 13:09 vnknt