HarmonyOS 使用仓库提供的扫一扫库,发现初始化报错无法使用@ohos/zxing

在使用zxing库发现初始化报错,如下:

Error message:Cannot read property height of undefinedSourceCode:this.__viewHeight = new ObservedPropertySimplePU(this.globalDisplay.height, this, “viewHeight”);^Stacktrace:at CameraPreview (oh_modules/.ohpm/@ohos+zxing@2.0.3/oh_modules/@ohos/zxing/src/main/ets/scan/CameraPreview.ets:28:31)at anonymous (oh_modules/.ohpm/@ohos+zxing@2.0.3/oh_modules/@ohos/zxing/src/main/ets/scan/CameraView.ets:136:19)
  • 1.
HarmonyOS
2024-12-11 16:01:54
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
put_get

修改build-profile.json5文件里面product的内容即可正常跑通,下面就是修改后的代码:

"products": [
{
  "name": "default",
"signingConfig": "default",
"compileSdkVersion": "4.1.0(11)",
"compatibleSdkVersion": "4.1.0(11)",
"runtimeOS": "HarmonyOS"
}
],
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
分享
微博
QQ
微信
回复
2024-12-11 18:00:57


相关问题
HarmonyOS 一扫功能Demo
694浏览 • 1回复 待解决
HarmonyOS 系统一扫问题
616浏览 • 1回复 待解决
ArkTs怎么实现一扫功能?
6049浏览 • 1回复 待解决
HarmonyOS 自定义一扫功能
770浏览 • 1回复 待解决
是否提供提前初始化webview能力
3200浏览 • 1回复 待解决
HarmonyOS 能否提供demo代码
943浏览 • 1回复 待解决
HarmonyOS 导出类使用时报未初始化
847浏览 • 1回复 待解决
rsa 公钥解密初始化报错
1231浏览 • 1回复 待解决
HarmonyOS XComponent初始化
1115浏览 • 1回复 待解决
HarmonyOS taskpool中new 对象报错初始化
1146浏览 • 1回复 待解决