Closed ja-bravo closed 2 months ago
same problem on android build with new architecture
cc @cortinico
that happens when the version of React Native and the CLI are not aligned.
Can you share which version of @react-native-community/cli-platform-android
you folks have installed?
Fixed the issue by adding to the package.json file:
"resolutions": {
"@react-native-community/cli": "13.6.6",
"@react-native-community/cli-clean": "13.6.6",
"@react-native-community/cli-config": "13.6.6",
"@react-native-community/cli-debugger-ui": "13.6.6",
"@react-native-community/cli-doctor": "13.6.6",
"@react-native-community/cli-hermes": "13.6.6",
"@react-native-community/cli-platform-android": "13.6.6",
"@react-native-community/cli-platform-ios": "13.6.6",
"@react-native-community/cli-server-api": "13.6.6",
"@react-native-community/cli-tools": "13.6.6",
"@react-native-community/cli-types": "13.6.6"
}
hey @miinos I'm glat that it works for you, however adding resolutions
field is not recommended way. If you don't override - what's the version of CLI that you have in project? You can check it by running:
yarn why @react-native-community/cli
hey @miinos I'm glat that it works for you, however adding
resolutions
field is not recommended way. If you don't override - what's the version of CLI that you have in project? You can check it by running:yarn why @react-native-community/cli
without resolutions:
├─ react-native@npm:0.73.6
│ └─ @react-native-community/cli@npm:12.3.6 (via npm:12.3.6)
│
├─ react-native@npm:0.74.1
│ └─ @react-native-community/cli@npm:13.6.6 (via npm:13.6.6)
│
├─ react-native@npm:0.74.1 [51e67]
│ └─ @react-native-community/cli@npm:13.6.6 (via npm:13.6.6)
│
└─ react-native@npm:0.73.6 [eb6a2]
└─ @react-native-community/cli@npm:12.3.6 (via npm:12.3.6)
with resolutions
├─ react-native@npm:0.73.6
│ └─ @react-native-community/cli@npm:13.6.6 (via npm:13.6.6)
│
├─ react-native@npm:0.74.1
│ └─ @react-native-community/cli@npm:13.6.6 (via npm:13.6.6)
│
├─ react-native@npm:0.74.1 [51e67]
│ └─ @react-native-community/cli@npm:13.6.6 (via npm:13.6.6)
│
└─ react-native@npm:0.73.6 [eb6a2]
└─ @react-native-community/cli@npm:13.6.6 (via npm:13.6.6)
Looks like you're having different versions of react-native
in your projects (that's most likely the root cause of your issue). Why is that the case?
Looks like you're having different versions of
react-native
in your projects (that's most likely the root cause of your issue). Why is that the case?
In my package.json
, I'm only using the latest version of react-native
: 0.74.1
@miinos can you share a repro then, where we can reproduce this issue?
i got the same error here too with latest version - react native: 0.74.1
Task :app:buildCMakeDebug[arm64-v8a] C/C++: ninja: Entering directory `/Users/Workspace/xx/android/app/.cxx/Debug/h1j1a4m5/arm64-v8a' C/C++: /Users/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android23 --sysroot=/Users/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dappmodules_EXPORTS -I/Users/Workspace/xx/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup -I/Users/Workspace/xx/android/app/build/generated/rncli/src/main/jni -I/Users/Workspace/xx/node_modules/react-native-safe-area-context/android/src/main/jni -I/Users/Workspace/xx/node_modules/react-native-screens/android/src/main/jni -I/Users/Workspace/xx/node_modules/react-native-svg/android/src/main/jni -I/Users/Workspace/xx/node_modules/@shopify/react-native-skia/android/build/generated/source/codegen/jni/. -I/Users/Workspace/xx/node_modules/@shopify/react-native-skia/android/build/generated/source/codegen/jni/react/renderer/components/rnskia -I/Users/Workspace/xx/node_modules/react-native-date-picker/android/build/generated/source/codegen/jni/. -I/Users/Workspace/xx/node_modules/react-native-date-picker/android/build/generated/source/codegen/jni/react/renderer/components/RNDatePickerSpecs -I/Users/Workspace/xx/node_modules/react-native-gesture-handler/android/build/generated/source/codegen/jni/. -I/Users/Workspace/xx/node_modules/react-native-gesture-handler/android/build/generated/source/codegen/jni/react/renderer/components/rngesturehandler_codegen -I/Users/Workspace/xx/node_modules/react-native-mmkv/android/build/generated/source/codegen/jni/. -I/Users/Workspace/xx/node_modules/react-native-mmkv/android/build/generated/source/codegen/jni/react/renderer/components/reactnativemmkv -I/Users/Workspace/xx/node_modules/react-native-reanimated/android/build/generated/source/codegen/jni/. -I/Users/Workspace/xx/node_modules/react-native-reanimated/android/build/generated/source/codegen/jni/react/renderer/components/rnreanimated -I/Users/Workspace/xx/node_modules/react-native-safe-area-context/android/src/main/jni/. -I/Users/Workspace/xx/node_modules/react-native-safe-area-context/android/src/main/jni/../../../../common/cpp -I/Users/Workspace/xx/node_modules/react-native-safe-area-context/android/src/main/jni/../../../build/generated/source/codegen/jni -I/Users/Workspace/xx/node_modules/react-native-safe-area-context/android/src/main/jni/../../../build/generated/source/codegen/jni/react/renderer/components/safeareacontext -I/Users/Workspace/xx/node_modules/react-native-screens/android/src/main/jni/. -I/Users/Workspace/xx/node_modules/react-native-screens/android/src/main/jni/../../../../common/cpp -I/Users/Workspace/xx/node_modules/react-native-screens/android/src/main/jni/../../../build/generated/source/codegen/jni -I/Users/Workspace/xx/node_modules/react-native-screens/android/src/main/jni/../../../build/generated/source/codegen/jni/react/renderer/components/rnscreens -I/Users/Workspace/xx/node_modules/react-native-svg/android/src/main/jni/. -I/Users/Workspace/xx/node_modules/react-native-svg/android/src/main/jni/../../../../common/cpp -I/Users/Workspace/xx/node_modules/react-native-svg/android/src/main/jni/../../../build/generated/source/codegen/jni -I/Users/Workspace/xx/node_modules/react-native-svg/android/src/main/jni/../../../build/generated/source/codegen/jni/react/renderer/components/rnsvg -I/Users/Workspace/xx/node_modules/react-native-vector-icons/android/build/generated/source/codegen/jni/. -I/Users/Workspace/xx/node_modules/react-native-vector-icons/android/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/fabricjni/include -isystem /Users/.gradle/caches/transforms-4/c7e26f7d3c2fc1a6636ff1467fc77795/transformed/jetified-fbjni-0.6.0/prefab/modules/fbjni/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/folly_runtime/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/glog/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/jsi/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_codegen_rncore/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_debug/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_utils/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_nativemodule_core/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_newarchdefaults/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_cxxreactpackage/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_render_componentregistry/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_render_core/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_render_debug/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_render_graphics/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_render_imagemanager/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_render_mapbuffer/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_render_textlayoutmanager/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/rrc_image/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/rrc_view/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/rrc_text/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/rrc_textinput/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/rrc_legacyviewmanagerinterop/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/runtimeexecutor/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/turbomodulejsijni/include -isystem /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/yoga/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fno-limit-debug-info -fPIC -Wall -Werror -Wno-error=cpp -fexceptions -frtti -std=c++20 -DLOG_TAG=\"ReactNative\" -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -MD -MT CMakeFiles/appmodules.dir/OnLoad.cpp.o -MF CMakeFiles/appmodules.dir/OnLoad.cpp.o.d -o CMakeFiles/appmodules.dir/OnLoad.cpp.o -c /Users/Workspace/xx/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp
C/C++: /Users/Workspace/xx/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:74:10: error: use of undeclared identifier 'rncli_cxxModuleProvider'; did you mean 'rncli_ModuleProvider'?
C/C++: return rncli_cxxModuleProvider(name, jsInvoker);
C/C++: ^~~~~~~
C/C++: rncli_ModuleProvider
C/C++: /Users/Workspace/xx/android/app/build/generated/rncli/src/main/jni/rncli.h:19:30: note: 'rncli_ModuleProvider' declared here
C/C++: std::shared_ptr~~~~
C/C++: /Users/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/react_nativemodule_core/include/ReactCommon/JavaTurboModule.h:28:10: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const std::shared_ptr
I could build & run iOS version, is it possible that I missed something to update when I do upgrade from 0.72 to 0.74.1?
i got the same error here too with latest version - react native: 0.74.1
Task :app:buildCMakeDebug[arm64-v8a] C/C++: ninja: Entering directory `/Users/Workspace/xx/android/app/.cxx/Debug/h1j1a4m5/arm64-v8a' C/C++: /Users/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --
I have the same error as above, iOS build running fine.
Facing same error on version 0.74.5 -
System: OS: macOS 14.5 CPU: (8) arm64 Apple M1 Memory: 131.44 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.18.0 path: ~/.nvm/versions/node/v18.18.0/bin/node Yarn: Not Found npm: version: 9.8.1 path: ~/.nvm/versions/node/v18.18.0/bin/npm Watchman: version: 2023.12.04.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/abhayagrawal/.gem/ruby/3.2.2/bin/pod SDKs: iOS SDK: Platforms:
@abhayagrawal-fareye please make sure that there's no package that overrides CLI packages, that was the solution for similar cases that you face - someone had an older dependency e.g. react-native-macos
which was overriding @react-native-community/cli
packages and then code couldn't be generated in correct way, because of the dependency mismatch under the hood.
Environment
Description
When building an Android app using the new architecture, there's an error on the generated cpp files. I've tried cleaning gradle and reinstalling node_modules but nothing worked.
The app is inside a NX monorepo.