HarmonyOS鸿蒙Next中GitCode下载的OpenHarmony / applications_camera 5.0.0 版本 API18编译一直报错

HarmonyOS鸿蒙Next中GitCode下载的OpenHarmony / applications_camera 5.0.0 版本 API18编译一直报错

> hvigor ERROR: ArkTS Compiler Error
1 ERROR: 10505001 ArkTS Compiler Error
Error Message: Namespace 'hiTraceMeter' has no exported member 'HiTraceOutputLevel'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:84:25

2 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'HiTraceOutputLevel' does not exist on type 'typeof hiTraceMeter'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:84:59

3 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'startAsyncTrace' does not exist on type 'typeof hiTraceMeter'. Did you mean 'startTrace'? At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:87:18

4 ERROR: 10505001 ArkTS Compiler Error
Error Message: Namespace 'hiTraceMeter' has no exported member 'HiTraceOutputLevel'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:97:25

5 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'HiTraceOutputLevel' does not exist on type 'typeof hiTraceMeter'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:97:59

6 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'finishAsyncTrace' does not exist on type 'typeof hiTraceMeter'. Did you mean 'finishTrace'? At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:100:18

7 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'chipType' does not exist on type 'typeof deviceInfo'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/component/deviceinfo/DeviceInfo.ts:24:58

8 ERROR: 10505001 ArkTS Compiler Error
Error Message: Expected 1 arguments, but got 2. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/service/UIAdaptive/DisplayService.ts:161:49

9 ERROR: 10505001 ArkTS Compiler Error
Error Message: This expression is not callable.
  Type '{}' has no call signatures. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1131:28

10 ERROR: 10505001 ArkTS Compiler Error
Error Message: This expression is not callable.
  Type '{}' has no call signatures. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1140:21

11 ERROR: 10505001 ArkTS Compiler Error
Error Message: This expression is not callable.
  Type '{}' has no call signatures. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1260:21

12 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'getWhiteBalanceMode' does not exist on type 'PhotoSession | VideoSession'.
  Property 'getWhiteBalanceMode' does not exist on type 'PhotoSession'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1268:29

13 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'setWhiteBalance' does not exist on type 'PhotoSession | VideoSession'.
  Property 'setWhiteBalance' does not exist on type 'PhotoSession'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1278:21

14 ERROR: 10505001 ArkTS Compiler Error
Error Message: This expression is not callable.
  Type '{}' has no call signatures. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1286:28

15 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'getWhiteBalance' does not exist on type 'PhotoSession | VideoSession'.
  Property 'getWhiteBalance' does not exist on type 'PhotoSession'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1295:29

16 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'usedAsPosition' does not exist on type 'CameraInput'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/SessionWrap.ts:350:19

COMPILE RESULT:FAIL {ERROR:17 WARN:1113}

* Try:
> Run with --debug option to get more log output.

> hvigor ERROR: Error: ArkTS Compiler Error
1 ERROR: 10505001 ArkTS Compiler Error
Error Message: Namespace 'hiTraceMeter' has no exported member 'HiTraceOutputLevel'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:84:25

2 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'HiTraceOutputLevel' does not exist on type 'typeof hiTraceMeter'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:84:59

3 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'startAsyncTrace' does not exist on type 'typeof hiTraceMeter'. Did you mean 'startTrace'? At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:87:18

4 ERROR: 10505001 ArkTS Compiler Error
Error Message: Namespace 'hiTraceMeter' has no exported member 'HiTraceOutputLevel'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:97:25

5 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'HiTraceOutputLevel' does not exist on type 'typeof hiTraceMeter'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:97:59

6 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'finishAsyncTrace' does not exist on type 'typeof hiTraceMeter'. Did you mean 'finishTrace'? At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/utils/HiLog.ts:100:18

7 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'chipType' does not exist on type 'typeof deviceInfo'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/component/deviceinfo/DeviceInfo.ts:24:58

8 ERROR: 10505001 ArkTS Compiler Error
Error Message: Expected 1 arguments, but got 2. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/service/UIAdaptive/DisplayService.ts:161:49

9 ERROR: 10505001 ArkTS Compiler Error
Error Message: This expression is not callable.
  Type '{}' has no call signatures. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1131:28

10 ERROR: 10505001 ArkTS Compiler Error
Error Message: This expression is not callable.
  Type '{}' has no call signatures. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1140:21

11 ERROR: 10505001 ArkTS Compiler Error
Error Message: This expression is not callable.
  Type '{}' has no call signatures. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1260:21

12 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'getWhiteBalanceMode' does not exist on type 'PhotoSession | VideoSession'.
  Property 'getWhiteBalanceMode' does not exist on type 'PhotoSession'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1268:29

13 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'setWhiteBalance' does not exist on type 'PhotoSession | VideoSession'.
  Property 'setWhiteBalance' does not exist on type 'PhotoSession'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1278:21

14 ERROR: 10505001 ArkTS Compiler Error
Error Message: This expression is not callable.
  Type '{}' has no call signatures. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1286:28

15 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'getWhiteBalance' does not exist on type 'PhotoSession | VideoSession'.
  Property 'getWhiteBalance' does not exist on type 'PhotoSession'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/BaseSession.ts:1295:29

16 ERROR: 10505001 ArkTS Compiler Error
Error Message: Property 'usedAsPosition' does not exist on type 'CameraInput'. At File: /Users/lesliehoa/GKH/Project/APP/applications_camera/common/src/main/ets/camera/childthread/modules/session/SessionWrap.ts:350:19

COMPILE RESULT:FAIL {ERROR:17 WARN:1113}
    at runArkPack (/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor-ohos-plugin/node_modules/@ohos/hvigor-arkts-compose/dist/src/arkts-pack.js:1:5736)
ArkTSCompilerError: ArkTS Compiler Error
    at throwArkTsCompilerError (/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor-ohos-plugin/node_modules/@ohos/hvigor-arkts-compose/dist/src/data/compose-error.js:1:423)
    at throwErrorIfHasErrorInfo (/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor-ohos-plugin/node_modules/@ohos/hvigor-arkts-compose/dist/src/plugins/common-plugin.js:1:4478)
    at Object.handler (/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor-ohos-plugin/node_modules/@ohos/hvigor-arkts-compose/dist/src/plugins/common-plugin.js:1:2547)
    at /Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor-ohos-plugin/node_modules/@ohos/hvigor-arkts-base/node_modules/rollup/dist/shared/rollup.js:27765:40
> hvigor ERROR: BUILD FAILED in 19 s 847 ms 

Process finished with exit code -1

更多关于HarmonyOS鸿蒙Next中GitCode下载的OpenHarmony / applications_camera 5.0.0 版本 API18编译一直报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

你这些报错都是错误码10505001,表示关键字或符号的缺失、赋值类型与接收类型不一致、类型或变量未定义等。这些问题通常是未按照语言规范编写代码导致的,是SDK版本不兼容导致的,5.0.0版本对应的是API 12,你用API 18去编译肯定会不兼容报错。

而且OpenHarmony/applications_camera5.0.0版本太老了,很多API都废弃了,现在最新的已经6.1.0 API23了,建议你用最新版本。

更多关于HarmonyOS鸿蒙Next中GitCode下载的OpenHarmony / applications_camera 5.0.0 版本 API18编译一直报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


这个看着好像是Api废弃了

API18 编译报错通常因 oh-package.json5 中的依赖版本或 hvigor 版本与 OpenHarmony 5.0.0 不匹配导致。需检查 build-profile.json5compileSdkVersion 是否为 18,以及 sign 配置正确。同步更新 hvigor 至 4.1.0+,并确保 NDK 与工具链完整。

这些编译错误是因为 applications_camera 5.0.0 是基于 OpenHarmony 5.0.0 (API 12) 设计的,而当前使用的 API 18 (HarmonyOS NEXT 5.0) SDK 已移除或重命名了相关 API。

  • hiTraceMeter 中不再导出 HiTraceOutputLevelstartAsyncTracefinishAsyncTrace 等成员。
  • deviceInfo 中不再提供 chipType 属性。
  • CameraInput.usedAsPositionPhotoSession/VideoSession 的白平衡相关方法也已变更或移除。

因此,直接编译会失败。需要切换到该仓与 API 18 兼容的分支,或根据 API 18 的变更适配代码。

回到顶部