owenlongbo/McImage

javax.imageio.IIOException: Unsupported JPEG process: SOF type 0xcd

Opened this issue · 0 comments

哈喽,碰到了个问题,我使用McImage,升级到最新的1.5.1,提示的是跟jpeg图片相关的问题,有点纳闷。配置么,用的就是你给的默认的配置

isCheckSize true //是否检测图片大小,默认为true
optimizeType "Compress" //优化类型,可选"ConvertWebp","Compress",转换为webp或原图压缩,默认Compress,使用ConvertWep需要min sdk >= 18.但是压缩效果更好
maxSize 110241024 //大图片阈值,default 1MB
enableWhenDebug false //debug下是否可用,default true
isCheckPixels true // 是否检测大像素图片,default true
maxWidth 1000 //default 1000 如果开启图片宽高检查,默认的最大宽度
maxHeight 1000 //default 1000 如果开启图片宽高检查,默认的最大高度
whiteList = [ //默认为空,如果添加,对图片不进行任何处理
]
isSupportAlphaWebp false //是否支持带有透明度的webp,default false,带有透明图的图片会进行压缩
multiThread false //是否开启多线程处理图片,default true
bigImageWhiteList = [] //默认为空,如果添加,大图检测将跳过这些图片

报的错误如下:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':bdsm:McImageRelease'.

javax.imageio.IIOException: Unsupported JPEG process: SOF type 0xcd

  • Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bdsm:McImageRelease'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:148)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)

后面改成了如下形式:目前看是没有报错了
// isCheckSize false
// optimizeType "Compress"
// isCheckPixels false
// isSupportAlphaWebp false
// enableWhenDebug false
// multiThread false
// whiteList = [ //do not do any optimization for the images who in the list
// "yw_1222_baichuan.jpg", "post.jpg"
// ]

对于这种情况,也有问题,whiteList里面添加的几个jpg图片,如果我不放到白名单里面,我的app就会crash,很奇怪,对于post.jpg, 可以理解为Glide加载的时候的placeHolder占位图,我从反编译的R文件里面,都找不到post这个资源id,很是邪门。。

对于这两个问题,想听听龙博大佬的分析。