打开预览Preview failed. Unable to start the previewer. Open PreviewerLog to check for details.

[Compile Result]  ArkTS:ERROR File: D:/DevEco/Linliyizhan/entry/src/main/ets/pages/My.ets

[Compile Result]  A page configured in 'main_pages.json' must have one and only one '@Entry' decorator.

[Compile Result] Compile error occurred. Fix it based on the above message.


DevEco Studio
2024-05-20 15:32:12
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
Joshun

单从错误信息看,在My.ets里面:

首先,有一个方法返回值不是void,也不是任意类型,但它最终没有返回值:[Compile Result]  A function whose declared type is neither 'void' nor 'any' must return a value;

其次,使用了两个及以上@Entry修饰符,而Page里面只允许有一个@Entry修饰符:[Compile Result]  A page configured in 'main_pages.json' must have one and only one '@Entry' decorator;

最后,build()方法内部应该有一个根容器组件:[Compile Result]  There should have a root container component.

分享
微博
QQ
微信
回复
2024-05-21 10:17:25
相关问题
Failed to start MySQL Monitor.
2184浏览 • 2回复 待解决
Error: Install eTS 3.1.0.0 failed.
2431浏览 • 1回复 待解决
DevEco Device无法使用Previewer预览
31497浏览 • 3回复 待解决
previewer 一直loading failed怎么回事?
1067浏览 • 1回复 待解决
Open Harmony开发的理解
8952浏览 • 1回复 待解决
Open Harmony 近场通信
5911浏览 • 1回复 待解决
open Harmony1.0如何使用curl库?
3845浏览 • 1回复 待解决