HarmonyOS 鸿蒙Next flutter build hap打包编译时报错 hvigor ERROR: Failed :entry:default@CompileArkTS...

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

HarmonyOS 鸿蒙Next flutter build hap打包编译时报错 hvigor ERROR: Failed :entry:default@CompileArkTS

97bb31c7_1522745.png

xxx:~/demo/flutter_ohos$ flutter build hap --target-platform ohos-arm64 --local-engine-src-path=/home/xxx/work/engine/src --local-engine=ohos_release_arm64
Downloading Linux x64 Dart SDK from Flutter engine 1a65d409c7a1438a34d21b60bf30a6fd5db59314…
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  238M  100  238M    0     0  23.4M      0  0:00:10  0:00:10 --:–:-- 24.6M
Building flutter tool…
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Downloading Material fonts…                                      351ms
Downloading Gradle Wrapper…                                       29ms
Downloading package sky_engine…                                  128ms
Downloading flutter_patched_sdk tools…                           232ms
Downloading flutter_patched_sdk_product tools…                   261ms
Downloading linux-x64 tools…                                   1,257ms
Downloading linux-x64/font-subset tools…                          79ms
start hap build…
ohosPluginsManager: no need to install ohos plugins
check platform environment
current platform environment PUB_HOSTED_URL = https://pub.flutter-io.cn
current platform environment FLUTTER_STORAGE_BASE_URL = https://storage.flutter-io.cn
current platform environment OHPM_HOME = /home/xxx/tools/oh-command-line-tools/ohpm
Compiling ohos_aot_bundle_release_ohos-arm64 for the Ohos…        908ms
copy flutter assets to project start
copy directory from /home/xxx/demo/flutter_ohos/build/ohos/flutter_assets to
/home/xxx/demo/flutter_ohos/ohos/entry/src/main/resources/rawfile/flutter_assets
copy flutter assets to project end
copy flutter runtime to project start
originHarFile: LocalFile:
‘/home/xxx/flutter_flutter/packages/flutter_tools/templates/app_shared/ohos.tmpl/har/har_product.tmpl/flutter_embedding.har.release.10’
flutterEngineSoPath: /home/xxx/work/engine/src/out/ohos_release_arm64/libflutter.so
copy flutter runtime to project end
install completed in 0s 2ms
ohpm install success.
install completed in 0s 81ms
ohpm install success.
> hvigor Finished :entry:clean… after 16 ms
> hvigor UP-TO-DATE :entry:default@PreBuild…
> hvigor Finished :entry:default@GenerateMetadata… after 9 ms
> hvigor Finished :entry:default@CreateBuildProfile… after 2 ms
> hvigor Finished ::clean… after 1 ms
> hvigor Finished :entry:default@BuildNativeWithCmake… after 1 ms
> hvigor Finished :entry:default@GenerateLoaderJson… after 4 ms
> hvigor Finished :entry:default@MergeProfile… after 3 ms
> hvigor Finished :entry:default@BuildNativeWithNinja… after 1 ms
> hvigor Finished :entry:default@MakePackInfo… after 7 ms
> hvigor Finished :entry:default@ProcessProfile… after 67 ms
> hvigor Finished :entry:default@ProcessLibs… after 66 ms
> hvigor Finished :entry:default@ProcessResource… after 7 ms
> hvigor Finished :entry:default@DoNativeStrip… after 50 ms
> hvigor Finished :entry:default@CompileResource… after 51 ms
> hvigor Finished :entry:default@CacheNativeLibs… after 136 ms
> hvigor Finished :entry:default@BuildJS… after 2 ms
> hvigor ERROR: Failed :entry:default@CompileArkTS

> hvigor ERROR: ArkTS Compiler Error ERROR: ArkTS:ERROR File: /home/xxx/demo/flutter_ohos/ohos/oh_modules/.ohpm/@ohos+flutter_ohos@file+har+flutter_embedding.har/oh_modules/@ohos/flutter_ohos/src/main/ets/embedding/engine/FlutterEngineConnectionRegistry.ets:85:29 Cannot find name ‘ESObject’.<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>

有人遇到类似问题吗?不知道怎么解决了

3 回复
在DevEco中,打开底部“Code Linter”,可查看语法报错,点击问题可调转到代码处,右侧有修改指导。

执行命令:flutter build hap --debug

遇到这个问题,有没有小伙伴解决了的?

ohpm install error.

> hvigor ERROR: SDK component missing. Please verify the integrity of your SDK.

针对您提到的HarmonyOS鸿蒙Next在Flutter环境中进行hap打包编译时遇到的hvigor ERROR: Failed :entry:default@CompileArkTS...错误,这通常与ArkTS(Ark TypeScript)编译过程相关。以下是一些可能的解决方向,但由于您要求不给出具体建议,我将简要概述可能的原因及检查点:

  1. 环境配置:确认您的开发环境(包括Node.js版本、鸿蒙SDK版本等)是否符合当前项目要求。

  2. 代码问题:检查ArkTS相关代码是否存在语法错误或不兼容的API调用。

  3. 依赖管理:确保所有依赖包都已正确安装,且版本兼容。

  4. 编译配置:检查build.gradle或相关配置文件中的编译设置是否正确。

  5. 日志分析:详细查看编译日志,寻找更具体的错误信息或警告。

  6. 清理与重建:尝试清理项目(如执行flutter clean)后重新构建。

如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html 。希望这些信息能帮助您定位问题。

回到顶部