HarmonyOS鸿蒙Next服务卡片开发-打包问题记录与解决
HarmonyOS鸿蒙Next服务卡片开发-打包问题记录与解决 在原子化服务开发过程中,打包成.app文件经常会遇到一个问题。估计大家也经常遇到。我们将解决方法共享。
15:58:23: Executing task ‘signReleaseApp --parallel’…
Executing tasks: [signReleaseApp] in project F:\A_work\project\BailianCard
Starting Gradle Daemon…
Gradle Daemon started in 6 s 948 ms
Task :preBuild
Task :validateReleaseAppSigning
Task :entry:preBuild
Task :entry:mergeReleaseJavaResource
Task :entry:compileReleaseIdl NO-SOURCE
Task :entry:mergeReleaseResources
Task :entry:mergeReleaseProfile
Task :entry:compileReleaseResources
Task :entry:compileReleaseRFile
Task :entry:generateReleaseBuildConfig
Task :entry:packageReleaseRClass
Task :entry:compileReleaseJavaWithJavac
Task :entry:generateReleaseJsManifest
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Task :entry:compileReleaseJsWithNode
Task :entry:processReleaseLibsFile
Task :entry:generateReleaseShell
Task :entry:processReleaseShellManifest
Task :entry:compileReleaseShellResources
Task :entry:linkReleaseShellResources
Task :entry:compileReleaseShellJavaWithJavac
Task :entry:transformReleaseShellClasses
Task :entry:packageReleaseShell
Task :entry:packageReleaseSimplifyShell
Task :entry:validateReleaseSigning
Task :entry:signReleaseShell
Task :entry:replaceReleaseLegacy
Task :entry:transformReleaseClasses
Task :entry:packageReleaseHap
十月 14, 2021 3:59:53 下午 com.huawei.ohos.Log error 警告: HarmonyOS BundleTool [Error]: isPicturing: the name is not same as formName, name: widget is not in [wkwidget]
十月 14, 2021 3:59:53 下午 com.huawei.ohos.Log error 警告: HarmonyOS BundleTool [Error]: Compressor::compressProcess Compress pack.res failed, Invalid resource file name: widget-2x2.png, correct format example is formName-2x2.png
十月 14, 2021 3:59:53 下午 com.huawei.ohos.Log error 警告: HarmonyOS BundleTool [Error]: Compressor::compressProcess Bundle exception
十月 14, 2021 3:59:53 下午 com.huawei.ohos.Log error 警告: HarmonyOS BundleTool [Error]: Compressor::compressProcess compress failed!
十月 14, 2021 3:59:53 下午 com.huawei.ohos.Log error 警告: HarmonyOS BundleTool [Error]: CompressEntrance::main exit, compress failed
Task :packageReleaseApp FAILED
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:packageReleaseApp’.
package pack.res failed
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
-
Get more help at https://help.gradle.org
BUILD FAILED in 1m 29s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use ‘–warning-mode all’ to show the individual deprecation warnings. See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
28 actionable tasks: 28 executed
15:59:53: Task execution finished ‘signReleaseApp --parallel’.
删除快照之后重新打包便成功,重新打开项目再次加入快照进行打包就可以正常打包。
更多关于HarmonyOS鸿蒙Next服务卡片开发-打包问题记录与解决的实战教程也可以访问 https://www.itying.com/category-93-b0.html
快照是snapshot这个目录吗
更多关于HarmonyOS鸿蒙Next服务卡片开发-打包问题记录与解决的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
怎么删除快照
找到快照的目录,删除掉就行了呀,这个是原子化服务与服务卡片开发的基础要求,你找找目录结构说明。
蛟龙胸总是这么到位
牛
相互学习共同成长,
好是好,就是看起来乱乱的,有点费劲啊
正在不断调整优化,
好文章写的真不错、学习收藏了
我觉得我需要一些文字解说…
大佬又发了令人看不懂的帖子,这一大串代码看的迷迷瞪瞪,学习了。
在HarmonyOS鸿蒙Next服务卡片开发中,打包问题可能涉及资源文件缺失、配置文件错误或依赖库版本不匹配。常见解决方法包括:
- 检查
config.json
文件,确保所有服务卡片配置正确; - 确认资源文件路径无误,避免文件丢失;
- 更新依赖库版本,确保与鸿蒙SDK兼容;
- 使用DevEco Studio的日志功能排查具体错误。
通过逐步排查,可有效解决打包问题,确保服务卡片顺利发布。