打开预览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
      
        赞
        
 收藏 0
 回答 1
 
        待解决
        
相关问题
 预览出现问题:Preview failed. View details in the PreviewerLog window 
3094浏览  • 1回复 待解决
the Reload icon to reload the preview. You can check information in the Log window for more details. 
3084浏览  • 0回复 待解决
Execution failed for task ':entry:signDebugShell'. > Sign shell failed. For details, see the log. 
3367浏览  • 1回复 待解决
error: install failed due to grant request permissions failed. 
6363浏览  • 1回复 待解决
HarmonyOS previewer预览报错 
1745浏览  • 1回复 待解决
ERROR: Schema validate failed. 
2031浏览  • 1回复 待解决
Failed to start MySQL Monitor. 
4511浏览  • 2回复 待解决
Error: Install eTS 3.1.0.0 failed. 
5448浏览  • 1回复 待解决
DevEco Device无法使用Previewer预览 
45901浏览  • 3回复 待解决
Unable to apply for remote emulators: Check the network connection or try again later. 
6176浏览  • 1回复 待解决
编译报错:hvigor ERROR: Error, Schema validate failed. 
5605浏览  • 1回复 待解决
previewer 一直loading failed怎么回事? 
4668浏览  • 1回复 待解决
HarmonyOS 系统Preview组件如何预览doc文件 
929浏览  • 1回复 待解决
HarmonyOS hypium运行报错:hypium device agent failed to start。 
1093浏览  • 1回复 待解决
页面中有路由参数时,使用Previewer预览报错 
1418浏览  • 1回复 待解决
使用HarmonyOS登录组件,报Failed to check the fingerprint of the app bundle 
2611浏览  • 1回复 待解决
错误码code:9568393 error: verify code signature failed.怎么处理? 
2540浏览  • 1回复 待解决
DevEco Studio预览报错 To preview components in an HSP怎么回事? 
1928浏览  • 1回复 待解决
有没有和我一样遇到previewer读取loading Failed的? 
10225浏览  • 1回复 待解决
DevEco 怎么打开实时的图层查看,不是preview 
9629浏览  • 2回复 已解决
错误码code: 9568403 error: check encryption failed怎么处理? 
1257浏览  • 1回复 待解决
错误码code:9568359 error: installd set selinux label failed.怎么处理? 
1233浏览  • 1回复 待解决
HarmonyOS  Preview Kit是否可以预览网络图片或者文件 
942浏览  • 1回复 待解决





















单从错误信息看,在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.