Runtime FAQs
Crash Error, Indicating That RNOH_C_API_ARCH Is Not Set
- Viewing the Crash Log The application is compiled and installed on the phone, but it crashes once it is run. View the crash log in DevEco Studio > Log > FaultLog.
- Error screenshot

- Solutions
-
This error is caused by the C API version. You need to set
RNOH_C_API_ARCH=1in the environment variable, restart DevEco Studio, choose Build > Clean Project, and recompile the code. -
If the preceding settings do not take effect, delete the
.cxxdirectory and recompile and run the code. -
If the problem still persists, set the following parameter in
CMakeLists.txt:set(RNOH_C_API_ARCH, 1) -
For details about how to analyze other crash problems, see Troubleshooting Guidelines for CppCrash.
"insertChild" Error for Crash in the Hybrid Solution
- Error screenshot

- Crash
When the hybrid solution is used, if a crash occurs and the
ComponentInstance::insertChildcall stack exists, check whetherCustomRNComponentFrameNodeFactoryis correctly created whenRNInstanceis created. Create the factory method correctly or upgrade the RNOH version to solve the problem.
"Cannot read property tag of undefined" Error for Crash in the Hybrid Solution
- Error screenshot

- Crash
When the hybrid solution is used, if an unexpected exit occurs and
CustomRNComponentFrameNodeFactoryis displayed at the bottom of the call stack, check whether the component name is placed in the array and transferred as thearkTsComponentNamesparameter when theRNApporRNInstanceis created.
"Couldn't create bindings between ETS and CPP. libRNOHApp is undefined." Error After Running
-
Symptom
An RN application crashes at runtime.
Error message: Couldn't create bindings between ETS and CPP. libRNOHApp is undefinedis displayed in FaultLog. -
Causes
The
libRNOHApplibrary corresponds to thelibrnoh_app.sodynamic library, and is a dynamic library product compiled by C++. The possible causes are as follows:- Cause 1:
librnoh_app.sodoes not exist. - Cause 2: If
librnoh_app.soexists, locate other causes.
- Cause 1:
-
Solutions
Check whether
librnoh_app.soexists. You can check whether the corresponding .so file exists in\entry\build\default\intermediates\libs\default\arm64-v8a\orlibs/arm64-v8aunder the root directory of the OpenHarmony project.-
Solution to cause 1: Edit the configuration file
entry/build-profile.json5and add theexternalNativeOptionsoption under buildOptions."buildOption": { "externalNativeOptions": { // Native compilation options "path": "./src/main/cpp/CMakeLists.txt", // CMakeLists.txt at the native layer "arguments": "", "cppFlags": "", } } -
Solution to cause 2:
(1) Check the Hilog to locate the fault. One possible cause is that
libhermes.sois not packed into XXX.hap. (The Hilog reportscan't find library libhermes.so in namespace: moduleNs_default.)(2) Alternatively, enable the error enhancement function of IDE, as shown in the following figure.

(3) There is an incompatible change in IDE upgrade. For details, see Document. Simply speaking, there are two HARs, and the .so file of HAR A depends on the .so file of HAR B. Before change, the .so file of HAR B is packed into HAR A.
(4) Solution: This problem is automatically solved when IDE is upgraded to the latest version.
Add the following information to
/build-profile.json5of the HAR module:(type=har in modules.json5) "nativeLib": { // Same level as apiType "excludeFromHar": false }For details about the parameters, see Document.
To solve the problem, you can also copy the content in the
oh_modules/@rnoh/react-native-openharmony/src/main/cpp/third-party/prebuiltdirectory of the RN source code to theoh_modules/@rnoh/react-native-openharmony/libsdirectory.
-