react-native-gesture-handler: Error building with New Architecture
Description
Error in building using latest version of react-native-gesture-handler and react-native,
> Task :react-native-gesture-handler:configureNdkBuildRelease FAILED
C/C++: C:/Users/lam.nh/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:651: Android NDK: Module rngesturehandler_modules depends on undefined modules: folly_runtime
C/C++: C:/Users/lam.nh/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:664: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies. . Stop.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-gesture-handler:configureNdkBuildRelease'.
> [CXX1405] error when building with ndkBuild using C:\Users\lam.nh\Desktop\test68\node_modules\react-native-gesture-handler\android\src\main\jni\Android.mk: Build command failed.
Error while executing process C:\Users\lam.nh\AppData\Local\Android\Sdk\ndk\21.4.7075529\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\lam.nh\Desktop\test68\node_modules\react-native-gesture-handler\android\src\main\jni\Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 NDK_OUT=C:\Users\lam.nh\Desktop\test68\node_modules\react-native-gesture-handler\android\build\intermediates\cxx\Release\d65f3214/obj NDK_LIBS_OUT=C:\Users\lam.nh\Desktop\test68\node_modules\react-native-gesture-handler\android\build\intermediates\cxx\Release\d65f3214/lib APP_CFLAGS+=-Wall APP_CFLAGS+=-Werror APP_CFLAGS+=-fexceptions APP_CFLAGS+=-frtti APP_CFLAGS+=-DWITH_INSPECTOR=1 APP_CPPFLAGS+=-std=c++17 APP_PLATFORM=android-21 APP_STL=c++_shared NDK_TOOLCHAIN_VERSION=clang GENERATED_SRC_DIR=C:\Users\lam.nh\Desktop\test68\android\app\build/generated/source PROJECT_BUILD_DIR=C:\Users\lam.nh\Desktop\test68\android\app\build REACT_ANDROID_DIR=C:\Users\lam.nh\Desktop\test68\node_modules\react-native/ReactAndroid REACT_ANDROID_BUILD_DIR=C:\Users\lam.nh\Desktop\test68\node_modules\react-native/ReactAndroid/build APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
C:/Users/lam.nh/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:651: Android NDK: Module rngesturehandler_modules depends on undefined modules: folly_runtime
C:/Users/lam.nh/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:664: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies. . Stop.
Platforms
- iOS
- Android
- Web
Screenshots
Steps To Reproduce
1/ create new project RN 0.68.2
2/ install react-native-gesture-handler
3/ newArchEnabled=true
in gradlew.properties
4/ run android
Expected behavior
Success build
Actual behavior
Fail build
Snack or minimal code example
Package versions
“react”: “17.0.2”, “react-native”: “0.68.2”, “react-native-gesture-handler”: “^2.5.0”
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (3 by maintainers)
I was able to fix the issue. It’s related to react-native-safe-area-context. Here is the PR: https://github.com/th3rdwave/react-native-safe-area-context/pull/302
With my fix I was able to run the app with RN 0.69.3 and the new arch and hermes in true
Hi! Because of the fact that it’s still very early in the new architecture adoption and some major changes between React Native 0.68 and 0.69 (and the fact that Reanimated will support the new architecture starting with RN 0.69), we decided to make Gesture Handler compatible with RN 0.69 without backwards compatibility (only on the new architecture, when using the old one it should work as expected). I’d recommend upgrading to RN 0.69, which should solve the problem.