Glide java.io.IOException(File unsuitable for memory mapping)
程序员文章站
2022-07-15 22:34:52
...
异常信息
03-06 14:43:26.656 W/Glide ( 852): class com.bumptech.glide.load.engine.GlideException: Failed to load resource
03-06 14:43:26.656 W/Glide ( 852): There were 2 causes:
03-06 14:43:26.656 W/Glide ( 852): java.io.IOException(File unsuitable for memory mapping)
03-06 14:43:26.656 W/Glide ( 852): java.io.IOException(File unsuitable for memory mapping)
03-06 14:43:26.656 W/Glide ( 852): call GlideException#logRootCauses(String) for more detail
03-06 14:43:26.656 W/Glide ( 852): Cause (1 of 6): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.nio.ByteBuffer, DATA_DISK_CACHE, https://XXX
03-06 14:43:26.656 W/Glide ( 852): There was 1 cause:
03-06 14:43:26.656 W/Glide ( 852): java.io.IOException(File unsuitable for memory mapping)
03-06 14:43:26.656 W/Glide ( 852): call GlideException#logRootCauses(String) for more detail
03-06 14:43:26.656 W/Glide ( 852): Cause (1 of 1): class java.io.IOException: File unsuitable for memory mapping
03-06 14:43:26.656 W/Glide ( 852): Cause (2 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, DATA_DISK_CACHE, https://XXX
03-06 14:43:26.656 W/Glide ( 852): Cause (1 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->FrameSequenceDrawable->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (2 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (3 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->Bitmap->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (4 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->BitmapDrawable->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (3 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, DATA_DISK_CACHE, https://XXX
03-06 14:43:26.656 W/Glide ( 852): Cause (1 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->Bitmap->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (2 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->BitmapDrawable->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (4 of 6): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.nio.ByteBuffer, REMOTE, https://XXX
03-06 14:43:26.656 W/Glide ( 852): There was 1 cause:
03-06 14:43:26.656 W/Glide ( 852): java.io.IOException(File unsuitable for memory mapping)
03-06 14:43:26.656 W/Glide ( 852): call GlideException#logRootCauses(String) for more detail
03-06 14:43:26.656 W/Glide ( 852): Cause (1 of 1): class java.io.IOException: File unsuitable for memory mapping
03-06 14:43:26.656 W/Glide ( 852): Cause (5 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, REMOTE, https://XXXX
03-06 14:43:26.656 W/Glide ( 852): Cause (1 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->FrameSequenceDrawable->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (2 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (3 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->Bitmap->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (4 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->BitmapDrawable->Drawable}
03-06 14:43:26.656 W/Glide ( 852): Cause (6 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, REMOTE, https://XXX
03-06 14:43:26.657 W/Glide ( 852): Cause (1 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->Bitmap->Drawable}
03-06 14:43:26.657 W/Glide ( 852): Cause (2 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->BitmapDrawable->Drawable}
03-06 14:43:26.657 I/Glide ( 852): Root cause (1 of 2)
03-06 14:43:26.657 I/Glide ( 852): java.io.IOException: File unsuitable for memory mapping
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.util.ByteBufferUtil.fromFile(ByteBufferUtil.java:40)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.model.ByteBufferFileLoader$ByteBufferFetcher.loadData(ByteBufferFileLoader.java:65)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.DataCacheGenerator.startNext(DataCacheGenerator.java:75)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:269)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233)
03-06 14:43:26.657 I/Glide ( 852): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
03-06 14:43:26.657 I/Glide ( 852): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
03-06 14:43:26.657 I/Glide ( 852): at java.lang.Thread.run(Thread.java:764)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)
03-06 14:43:26.657 I/Glide ( 852): Root cause (2 of 2)
03-06 14:43:26.657 I/Glide ( 852): java.io.IOException: File unsuitable for memory mapping
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.util.ByteBufferUtil.fromFile(ByteBufferUtil.java:40)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.model.ByteBufferFileLoader$ByteBufferFetcher.loadData(ByteBufferFileLoader.java:65)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.DataCacheGenerator.startNext(DataCacheGenerator.java:75)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:49)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:272)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233)
03-06 14:43:26.657 I/Glide ( 852): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
03-06 14:43:26.657 I/Glide ( 852): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
03-06 14:43:26.657 I/Glide ( 852): at java.lang.Thread.run(Thread.java:764)
03-06 14:43:26.657 I/Glide ( 852): at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)
原因分析
解决方案
-
直接跳过缓存加载
-
通过glide的签名方式区分图片url,详见这里
-
直接在加载失败的时候通过跳过缓存方式重试一次
skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE)
上一篇: 图像处理之OpenCvSharp(一.图像修复-处理水印)
下一篇: 两个数组的交集1