Locating FAQs
Incorrect Attribute Settings
- Methods
- Open
ArkUI Inspectorat the bottom of DevEco Studio and select the application that encounters the issue. For details, see Layout Analysis.
- Find the faulty component on the displayed page. If the component is not displayed, you can use the component tree on the left of the page to find the component based on the text, component type, and tag (if attributes such as nativeId are not set, id is used by default).
- Select the component, view the attributes on the right of the page, and find the faulty attribute.

- Determine the cause based on the attribute.
- The abnormal value cannot be processed by ArkUI and needs to be adapted.
- The input value is incorrect. You need to find the incorrect value.
- Check the sources of the input attribute values:
- Modify the component attributes by performing operations on the component tree. Print the operation in the
handleMutationfunction ofsrc/main/cpp/RNOH/SchedulerDelegateCAPI.hto check whether the component is created in a correct sequence. - Use the NativeDriver of Animated to modify the component attributes. Print the modified attributes in the
synchronouslyUpdateViewOnUIThreadfunction ofsrc/main/cpp/RNOH/SchedulerDelegateCAPI.cppto further determine the location where the fault occurs. - Both of the preceding methods proceed to
onPropsChangedofxxxComponentInstance. Print the attributes here. Run thegetTagcommand to obtain the tag information of the component and locate the fault based on the attributes.
- Modify the component attributes by performing operations on the component tree. Print the operation in the
- Determine the cause of the problem based on the faulty attribute and rectify the fault accordingly.
- If the component exits unexpectedly, rectify the fault by referring to the following related FAQ. If the problem is not common, see Troubleshooting Guidelines for CppCrash for analysis.
Image Loading Failure
- Methods
- Check whether the path for loading an image by local mode or sandbox is correct.
Currently, the directories for loading an image by local mode or sandbox are encoded in different ways. For an image loaded by local mode, the image is searched from the
rawfile/assetsdirectory, so the image resources need to be stored under this directory. For an image loaded by sandbox, the image is directly searched from the directory at the same level as the bundle, and no additional assets directory is required. - Check whether the name of image is the same as that of the loaded image.
- Print the path and file name of the image in
onPropsChangedofsrc/main/cpp/RNOHCorePackage/ComponentInstances/ImageComponentInstance.cppand compare them with those in the assets directory or sandbox directory. Ensure that they are consistent. - If they are different, check whether
copyAssetsis performed when a custom bundle command is used, to ensure that the image resource is consistent with that encoded in the bundle.
- Print the path and file name of the image in
- Based on the troubleshooting for [incorrect attribute settings](#Incorrect Attribute Settings), check which attribute causes the image loading failure.
Running Errors After the Environment Is Updated
-
Methods
Check whether the cache is not cleared.
- Click
build->clean project. - Manually delete the temporary file directories (
.cxx,oh_modules) generated by the project. - Click
File->Sync and Refresh Project.
- Click
Failure to Set Events Effective
-
Example
The RN side cannot receive the
emitComponentEventevent of the Fabric component generated by the Codegen. -
Symptom
When you use the Codegen to implement a MarqueeView component that is the same as that in SampleApp and call
emitComponentEventto send theonStopevent to the RN side, the event is not executed.this.ctx.rnInstance.emitComponentEvent( this.descriptor.tag, "onStop", { isStop: !this.start, type: "custom" } ) -
Cause
The
EventEmitterandEventEmitRequestHandlerfiles are missing in the file structure generated by Codegen, and the generated code is contained in theRNOHGeneratedPackage.hfile.class GeneratedEventEmitRequestHandler : public EventEmitRequestHandler { public: void handleEvent(Context const &ctx) override { auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag); if (eventEmitter == nullptr) { return; } std::vector<std::string> supportedEventNames = { ... "stop", }; if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) { eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload)); } } }; class RNOHGeneratedPackage : public Package { EventEmitRequestHandlers createEventEmitRequestHandlers() override { return { std::make_shared<GeneratedEventEmitRequestHandler>(), }; } };All Fabric components generated by Codegen use the same
GeneratedEventEmitRequestHandler. Note that the event name insupportedEventNamesisstop, which is automatically mapped toonStopat the JSI layer. Therefore, ifonStopis used as the sending event name, the event name cannot be identified in the preceding code. -
Solution
Change the second parameter to
stop.this.ctx.rnInstance.emitComponentEvent( this.descriptor.tag, "stop", { isStop: !this.start, type: "custom" } )