fluttercandies / flutter_photo_manager

A Flutter plugin that provides images, videos, and audio abstraction management APIs without interface integration, available on Android, iOS, macOS and OpenHarmony.
https://pub.dev/packages/photo_manager
Apache License 2.0
653 stars 300 forks source link

[BUG] Android Image loading error #902

Open LiangLuDev opened 1 year ago

LiangLuDev commented 1 year ago

error logs :

I/Glide ( 9972): Root cause (3 of 3) I/Glide ( 9972): java.lang.IllegalArgumentException: setDataSource failed: status = 0xFFFFFFEA I/Glide ( 9972): at android.media.MediaMetadataRetriever._setDataSource(Native Method) I/Glide ( 9972): at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:312) I/Glide ( 9972): at com.bumptech.glide.load.resource.bitmap.VideoDecoder$AssetFileDescriptorInitializer.initialize(VideoDecoder.java:422) I/Glide ( 9972): at com.bumptech.glide.load.resource.bitmap.VideoDecoder$AssetFileDescriptorInitializer.initialize(VideoDecoder.java:417) I/Glide ( 9972): at com.bumptech.glide.load.resource.bitmap.VideoDecoder.decode(VideoDecoder.java:188) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:92) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:70) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:59) I/Glide ( 9972): at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:76) I/Glide ( 9972): at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:57) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:539) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:503) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:489) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:434) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:399) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:211) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:101) I/Glide ( 9972): at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:45) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:88) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:442) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:399) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:211) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:101) I/Glide ( 9972): at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:45) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:88) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:442) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:399) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:211) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:101) I/Glide ( 9972): at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:45) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:88) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:442) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:399) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:211) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:101) I/Glide ( 9972): at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:45) I/Glide ( 9972): at com.bumptech.glide.load.model.stream.QMediaStoreUriLoader$QMediaStoreUriFetcher.loadData(QMediaStoreUriLoader.java:141) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:88) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:442) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:399) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:211) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:101) I/Glide ( 9972): at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:145) I/Glide ( 9972): at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:45) I/Glide ( 9972): at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100) I/Glide ( 9972): at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.startNextOrFail(MultiModelLoader.java:164) I/Glide ( 9972): at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:147) I/Glide ( 9972): at com.bumptech.glide.load.data.mediastore.ThumbFetcher.loadData(ThumbFetcher.java:62) I/Glide ( 9972): at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100) I/Glide ( 9972): at com.bumptech.glide.load.model.stream.QMediaStoreUriLoader$QMediaStoreUriFetcher.loadData(QMediaStoreUriLoader.java:141) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:88) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:442) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:399) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:211) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:101) I/Glide ( 9972): at com.bumptech.glide.load.data.mediastore.ThumbFetcher.loadData(ThumbFetcher.java:62) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95) I/Glide ( 9972): at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:88) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:280) I/Glide ( 9972): at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235) I/Glide ( 9972): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) I/Glide ( 9972): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) I/Glide ( 9972): at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:421) I/Glide ( 9972): at java.lang.Thread.run(Thread.java:930) I/Glide ( 9972): at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultPriorityThreadFactory$1.run(GlideExecutor.java:380)

======== Exception caught by photo_manager ========================================================= The following PlatformException was thrown: PlatformException(Thumbnail request error, java.util.concurrent.ExecutionException: com.bumptech.glide.load.engine.GlideException: Failed to load resource There were 3 root causes: java.lang.IllegalArgumentException(setDataSource failed: status = 0xFFFFFFEA) java.lang.IllegalArgumentException(setDataSource failed: status = 0xFFFFFFEA) java.lang.IllegalArgumentException(setDataSource failed: status = 0xFFFFFFEA) call GlideException#logRootCauses(String) for more detail, null, null)

When the exception was thrown, this was the stack: StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7) MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)

AssetEntityImageProvider._loadAsync (package:photo_manager/src/internal/image_provider.dart:118:16)
LiangLuDev commented 1 year ago

I went to the system album to check the wrong picture, and there was also a problem, but once the error was reported, it would affect the loading of the following pictures, and it would be stuck for a while

LiangLuDev commented 1 year ago

在系统相册查看报错的几张图片,有几张是正常无法打开的。 但是我看很老的版本(0.x 和1.x)好像是没问题的。 出现报错会导致图片加载不了,等待了好久才恢复继续加载

LiangLuDev commented 1 year ago

Because the width and height of the picture are 0

image
AlexV525 commented 1 year ago

We need to figure out how to remove empty assets and keep the counting of paths working.

LiangLuDev commented 1 year ago

I don't know. I accidentally found this problem by using my colleague's phone

Wbqqqq commented 9 months ago

Hello , any progress?

Fansvaer commented 8 months ago

MOV的视频,获取缩略图失败,也会导致后续其他的缩略图获取需要等很久

yuanting2016 commented 3 months ago

is it fixed?

wdcs-dimilkalathiya commented 3 months ago

This issue happens if you have broken assets on device e.g if download was canceled middle or corrupted file

if you delete specific file it solves problem but there should be way to identify such assets and not try to load them in the first place

lyngbach commented 1 month ago

Seems to happen as well on Android Emulator when you have some video files where the playback wont work.

Detecting if a bad file is there and exclude it would be awesome.