导入示例工程出现error: failed to start ability. Error while Launching activity错误的解决办法

导入华为健康生活应用(ArkTS),使用DevEco Studio打开,运行报错:

error: failed to start ability. 
Error while Launching activity

在这里插入图片描述
解决办法:修改module.json5里面exported的值,由false改为true即可

"exported": true,

在这里插入图片描述

可以正常运行了:

在这里插入图片描述

查看module.json5配置文件说明,对exported的说明如下:

在这里插入图片描述

设置值为false时不能被其他应用调用,所以出现错误。

参考华为论坛:

https://developer.huawei.com/consumer/cn/forum/topic/0204126532204858364

猜你喜欢

转载自blog.csdn.net/SSY_1992/article/details/132230743