HarmonyOS 鸿蒙Next ImagePacker压缩图片闪退

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

HarmonyOS 鸿蒙Next ImagePacker压缩图片闪退

核心代码这些

错误堆栈:

Reason:Signal:SIGSEGV(SEGV_MAPERR)@0x0000005c198b1640 
Fault thread info:
Tid:13831, Name:OS_FFRT_3_24
#00 pc 000000000144da8c /system/lib64/libskia_canvaskit.z.so(jsimd_extrgbx_ycc_convert_neon+56)(87e59431b2fb8cb33263170b1d7818df)
#01 pc 00000000014229a0 /system/lib64/libskia_canvaskit.z.so(pre_process_data+152)(87e59431b2fb8cb33263170b1d7818df)
#02 pc 000000000141b3e0 /system/lib64/libskia_canvaskit.z.so(process_data_simple_main+208)(87e59431b2fb8cb33263170b1d7818df)
#03 pc 0000000001407038 /system/lib64/libskia_canvaskit.z.so(jpeg_write_scanlines+176)(87e59431b2fb8cb33263170b1d7818df)
#04 pc 00000000012bb02c /system/lib64/libskia_canvaskit.z.so(SkJpegEncoder::onEncodeRows(int)+372)(87e59431b2fb8cb33263170b1d7818df)
#05 pc 000000000117759c /system/lib64/libskia_canvaskit.z.so(SkEncoder::encodeRows(int)+80)(87e59431b2fb8cb33263170b1d7818df)
#06 pc 00000000012bb0b8 /system/lib64/libskia_canvaskit.z.so(SkJpegEncoder::Encode(SkWStream*, SkPixmap const&, SkJpegEncoder::Options const&)+64)(87e59431b2fb8cb33263170b1d7818df)
#07 pc 000000000ff1494 /system/lib64/libskia_canvaskit.z.so(SkEncodeImage(SkWStream*, SkPixmap const&, SkEncodedImageFormat, int)+252)(87e59431b2fb8cb33263170b1d7818df)
#08 pc 00000000011774b8 /system/lib64/libskia_canvaskit.z.so(SkEncodeImage(SkWStream*, SkBitmap const&, SkEncodedImageFormat, int)+148)(87e59431b2fb8cb33263170b1d7818df)
#09 pc 000000000097cd0 /system/lib64/platformsdk/libextplugin.z.so(OHOS::ImagePlugin::ExtEncoder::DoEncode(SkWStream*, SkBitmap const&, SkEncodedImageFormat const&)+280)(87415ace8113cf71a711fa178af6a6fe)
#10 pc 000000000097a6c /system/lib64/platformsdk/libextplugin.z.so(OHOS::ImagePlugin::ExtEncoder::EncodeImageByBitmap(SkBitmap&, bool, SkWStream&)+320)(87415ace8113cf71a711fa178af6a6fe)
#11 pc 00000000009591c /system/lib64/platformsdk/libextplugin.z.so(OHOS::ImagePlugin::ExtEncoder::EncodeImageByPixelMap(OHOS::Media::PixelMap*, bool, SkWStream&)+968)(87415ace8113cf71a711fa178af6a6fe)
#12 pc 0000000000948d4 /system/lib64/platformsdk/libextplugin.z.so(OHOS::ImagePlugin::ExtEncoder::PixelmapEncode(OHOS::ImagePlugin::ExtWStream&)+132)(87415ace8113cf71a711fa178af6a6fe)
#13 pc 00000000009468c /system/lib64/platformsdk/libextplugin.z.so(OHOS::ImagePlugin::ExtEncoder::FinalizeEncode()+952)(87415ace8113cf71a711fa178af6a6fe)
#14 pc 0000000000c08c0 /system/lib64/platformsdk/libimage_native.z.so(std::__h::__function::__func<OHOS::Media::ImagePacker::FinalizePacking()::$_3, std::__h::allocator<OHOS::Media::ImagePacker::FinalizePacking()::$_3>, unsigned int (OHOS::ImagePlugin::AbsImageEncoder*)>::operator()(OHOS::ImagePlugin::AbsImageEncoder*&&)+56)(a35058868d70826322f4747bf49361b3)
#15 pc 0000000000be92c /system/lib64/platformsdk/libimage_native.z.so(OHOS::Media::ImagePacker::DoEncodingFunc(std::__h::function<unsigned int (OHOS::ImagePlugin::AbsImageEncoder*)>, bool)+300)(a35058868d70826322f4747bf49361b3)
#16 pc 0000000000c0974 /system/lib64/platformsdk/libimage_native.z.so(OHOS::Media::ImagePacker::FinalizePacking(long&)+80)(a35058868d70826322f4747bf49361b3)
#17 pc 0000000000a4e48 /system/lib64/platformsdk/libimage_napi.z.so(OHOS::Media::PackingExec(napi_env__*, void*) (.cfi)+856)(ead55f0a5b46a1a403d580b9309bd3d9)
#18 pc 0000000000662c0 /system/lib64/platformsdk/libace_napi.z.so(NativeAsyncWork::AsyncWorkCallback(uv_work_s*)+512)(e9eee6ffeb9040c06af8fe2188c7ee8e)
#19 pc 000000000012784 /system/lib64/platformsdk/libuv.so(uv__ffrt_work+52)(afecd0c8f506e5fc1661ef2cb46dea9d)
#20 pc 000000000067af4 /system/lib64/ndk/libffrt.so(ffrt::CPUWorker::Run(ffrt_executor_task*, int)+488)(12aed295d22d65f7ec57605ce0bfb249)
#21 pc 000000000068324 /system/lib64/ndk/libffrt.so(ffrt::CPUWorker::RunTask(ffrt_executor_task*, ffrt::CPUWorker*)+124)(12aed295d22d65f7ec57605ce0bfb249)
#22 pc 00000000006873c /system/lib64/ndk/libffrt.so(ffrt::CPUWorker::WorkerLooperDefault(ffrt::WorkerThread*)+272)(12aed295d22d65f7ec57605ce0bfb249)
#23 pc 0000000000681c0 /system/lib64/ndk/libffrt.so(ffrt::CPUWorker::Dispatch(ffrt::CPUWorker*)+144)(12aed295d22d65f7ec57605ce0bfb249)
#24 pc 000000000068118 /system/lib64/ndk/libffrt.so(ffrt::CPUWorker::WrapDispatch(void*)+28)(12aed295d22d65f7ec57605ce0bfb249)
#25 pc 000000001bac20 /system/lib/ld-musl-aarch64.so.1(start+236)(fbb1eb526bb54f59c5dc4f2521b68e52)

更多关于HarmonyOS 鸿蒙Next ImagePacker压缩图片闪退的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

试下压缩图片的demo,我这边验证没问题可以正常运行的(模拟器也可以)

https://gitee.com/harmonyos_samples/image-compression

更多关于HarmonyOS 鸿蒙Next ImagePacker压缩图片闪退的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


针对HarmonyOS(鸿蒙)Next ImagePacker压缩图片时出现的闪退问题,可能的原因及解决方案如下:

  1. 资源占用过高:ImagePacker在处理大量或高分辨率图片时,可能会因为内存或CPU资源占用过高而导致应用闪退。检查图片资源的数量和大小,尝试分批处理或优化图片尺寸和质量。

  2. 软件兼容性问题:确保你使用的ImagePacker工具与当前的鸿蒙系统版本兼容。鸿蒙系统不断更新,旧版本的工具可能不再支持新系统的特性。

  3. 代码错误:如果ImagePacker是通过代码调用的,检查调用代码是否存在逻辑错误或异常处理不当的情况。确保异常被妥善处理,避免程序因未捕获的异常而崩溃。

  4. 系统权限问题:确认应用具有读写存储空间的权限,因为ImagePacker在处理图片时需要访问文件系统。

  5. 软件Bug:可能是ImagePacker本身的Bug导致的闪退。尝试更新到最新版本,或查看鸿蒙系统的官方论坛和社区,看是否有其他用户报告了相同的问题。

如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html

回到顶部