将React Native项目运行至鸿蒙平台

遇到的问题1【BuildNativeWithCmake等问题】

遇到的问题
hvigor ERROR: Failed :entry:default@BuildNativeWithCmake... 
> hvigor ERROR: Exceptions happened while executing: Not searching for unused variables given on the command line.
CMake Warning (dev) at CMakeLists.txt:1 (project):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is Clang 15.0.4
-- The CXX compiler identification is Clang 15.0.4
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/ruanjian/DevEcoStudioAll/DevEcoStudio5011100/sdk/default/openharmony/native/llvm/bin/clang.exe - 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: D:/ruanjian/DevEcoStudioAll/DevEcoStudio5011100/sdk/default/openharmony/native/llvm/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Configuring incomplete, errors occurred!
CMake Error at CMakeLists.txt:14 (add_subdirectory):
  add_subdirectory given source
  "E:/xiangmu/HarmonyOSApp/MyApplicationRN/entry/src/main/cpp/../../../oh_modules/@rnoh/react-native-openharmony/src/main/cpp"
  which is not an existing directory.



> hvigor ERROR: BUILD FAILED in 6 s 439 ms 
解决方案

解决方案
image

遇到的问题2【Reason:Signal:SIGABRT(SI_TKILL)等问题】

遇到的问题
Reason:Signal:SIGABRT(SI_TKILL)@0x01317bee00008bbf from:35775:20020206
LastFatalMessage:█____ RNInstanceFactory.h:280> The C_API architecture also needs to be enabled on the CPP side. Have you set the RNOH_C_API_ARCH="1" environment variable, completely closed and reopened DevEco Studio and run Build > Clean Project?

闪退
解决方案
重启了一下电脑和手机,再用管理员模式打开 WebStorm 和 DevEco Studio,运行项目没有问题。
posted @ 2025-05-29 15:47  喵碳  阅读(184)  评论(0)    收藏  举报