试着运行大佬写的应用结果报错,HarmonyOS 鸿蒙Next希望大家能给指点一下

发布于 1周前 作者 htzhanglong 来自 鸿蒙OS

试着运行大佬写的应用结果报错,HarmonyOS 鸿蒙Next希望大家能给指点一下 Bulid Output中完整报告如下

ConfigJsonError: File: C:\Users\Administrator\Desktop\project\project\项目源代码\SmartNote\entry\src\main\config.json:1 Reason: #/module/abilities/0/formEnabled: formEnabled is not a valid enum value

ConfigJsonError: File: C:\Users\Administrator\Desktop\project\project\项目源代码\SmartNote\entry\src\main\config.json:1 Reason: #/module/abilities/1/formEnabled: formEnabled is not a valid enum value

感觉可能是config.json文件的问题,自己一直没有搞懂,希望大佬们能指导一下怎么处理


更多关于试着运行大佬写的应用结果报错,HarmonyOS 鸿蒙Next希望大家能给指点一下的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

9 回复

楼主你好,报错信息显示“The config.json apiVersion tag of the entry module has been deprecated. You can configure this tag in entry build.gradle”,删除config.json文件中apiVersion 配置字段,再重新编译即可解决,或者您可以下载HarmonyOS官网最新版本的ide开发工具,重新生成模板,就是已经配置好的工程。

更多关于试着运行大佬写的应用结果报错,HarmonyOS 鸿蒙Next希望大家能给指点一下的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


可能你运行的代码是之前开发的, 现在新的开发环境对config.json要求有些严格, 比如描述要引用资源文件, 你这里报错好像是说config.json文件里的formEnabled这个的值不对吧.

嗯嗯谢谢你,我把"formEnabled": false,改为"visible": false, 可以继续向下运行了。但是现在又报错:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

想请教一下这里怎么解决呀?

你运行的代码是有服务卡片功能吧?那你要提供 formEnabledvisible。如果有服务卡片,应该是 "formEnabled": true"visible": true。你最好还是把 config.json 文件全部内容发出来看看。

app:

  • bundleName: com.harmonyos.smartnote
  • vendor: harmonyos
  • version:
    • code: 1
    • name: 1.0
  • apiVersion:
    • compatible: 4
    • target: 7
    • releaseType: Release

module:

  • package: com.harmonyos.smartnote
  • name: .MyApplication
  • reqCapabilities:
    • video_support
  • reqPermissions:
    • ohos.permission.GET_DISTRIBUTED_DEVICE_INFO
    • com.huawei.permission.ACCESS_DISTRIBUTED_ABILITY_GROUP
    • com.huawei.permission.ACCESS_DISTRIBUTED_ABILITY
    • ohos.permission.DISTRIBUTED_DATASYNC
    • ohos.permission.servicebus.DISTRIBUTED_DEVICE_STATE_CHANGE
    • ohos.permission.servicebus.ACCESS_SERVICE
    • com.huawei.permission.MANAGE_DISTRIBUTED_PERMISSION
    • ohos.permission.READ_USER_STORAGE
    • ohos.permission.WRITE_USER_STORAGE
    • ohos.permission.MICROPHONE
    • ohos.permission.INTERNET
    • ohos.permission.GET_NETWORK_INFO
    • com.huawei.hwddmp.servicebus.BIND_SERVICE
  • deviceType:
    • phone
  • distro:
    • deliveryWithInstall: true
    • moduleName: entry
    • moduleType: entry
    • installationFree: true
  • abilities:
    • skills:
      • entities:
        • entity.system.home
      • actions:
        • action.system.home
      • orientation: portrait
      • visible: false
      • name: com.harmonyos.smartnote.MainAbility
      • icon: $media:smartnote
      • description: $string:mainability_description
      • label: $string:entry_MainAbility
      • type: page
      • launchType: standard
    • skills:
      • actions:
        • action.demo.smartnote.note
      • orientation: portrait
      • formEnabled: false
      • name: com.harmonyos.smartnote.NoteAbility
      • icon: $media:smartnote
      • description: $string:mainability_description
      • label: $string:secondability_description
      • type: page
      • launchType: singleton
    • visible: true
    • name: com.harmonyos.smartnote.NoteServiceAbility
    • icon: $media:icon
    • type: service

config.json有问题吧,把错误日志看全,看仔细,哪里错了改哪里

不要有中文路径哦

欢迎开发小伙伴们进来帮帮楼主

针对您提到的在HarmonyOS(鸿蒙)Next上运行应用时遇到的报错问题,这里提供一些可能的解决方向,但遵循您的要求,不涉及Java、C语言相关内容,也不提供具体建议或推荐咨询华为开发者支持。

首先,确认报错信息是关键。报错通常会指出问题所在,比如是资源加载失败、权限问题、系统API不兼容等。根据报错信息定位问题,是解决问题的第一步。

其次,检查应用是否与鸿蒙Next系统兼容。由于鸿蒙系统在不断更新迭代,一些旧的应用或代码可能在新版本上存在不兼容的情况。查看应用的文档或更新日志,确认其是否支持鸿蒙Next版本。

再者,确认应用所需的依赖库和框架是否已正确安装并配置。在鸿蒙系统中,某些功能可能依赖于特定的库或框架,如果缺失或配置错误,也会导致应用运行失败。

最后,如果报错信息不够明确,或者以上步骤无法解决问题,可以尝试在鸿蒙开发者社区中搜索相似问题或发帖求助。鸿蒙开发者社区中有大量经验丰富的开发者,他们可能遇到过类似问题,并能提供有效的解决方案。

如果问题依旧没法解决请联系官网客服,官网地址是:

https://www.itying.com/category-93-b0.html

回到顶部