Symptom
A window in a HAR is used to display a toast, whose content is implemented through a page. However, when window.setUIContent is called to load the page, an import failure occurs.
Solution
- HARs do not support pages. It is recommended that you declare the window in the HAP to place the HAR or HSP components.
- To implement a toast, you can use the ArkTS components for creating a custom dialog box UI.
Reference
Custom Dialog Box (CustomDialog)