Cannot load Adaptive Icons (ProgressiveDecoder: unknown image format)
See original GitHub issueDescription
Trying to load the URI identifier for installed applications icons fails for some apps (system and non-system) and throws some logs:
D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.sonymobile.synchub/2131427328, firstEncodedBytes: 03000800840100000100, length: 388} D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.google.android.calendar/2130903042, firstEncodedBytes: 03000800480200000100, length: 584} D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.android.chrome/2131231050, firstEncodedBytes: 03000800540100000100, length: 340} D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.sonyericsson.organizer/2130903043, firstEncodedBytes: 03000800C80100000100, length: 456} D/skia: — SkAndroidCodec::NewFromStream returned null D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.google.android.apps.docs.editors.docs/2130838355, firstEncodedBytes: 030008008C0200000100, length: 652} D/skia: — SkAndroidCodec::NewFromStream returned null D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.google.android.apps.docs/2130837900, firstEncodedBytes: 03000800280200000100, length: 552} D/skia: — SkAndroidCodec::NewFromStream returned null D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.sonymobile.email/2130903040, firstEncodedBytes: 03000800280200000100, length: 552} D/skia: — SkAndroidCodec::NewFromStream returned null D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://flar2.exkernelmanager/2131558401, firstEncodedBytes: 03000800F40100000100, length: 500} D/skia: — SkAndroidCodec::NewFromStream returned null D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.google.android.inputmethod.latin/2130903043, firstEncodedBytes: 03000800280200000100, length: 552} D/skia: — SkAndroidCodec::NewFromStream returned null D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.google.android.gm/2130903042, firstEncodedBytes: 03000800280200000100, length: 552} D/skia: — SkAndroidCodec::NewFromStream returned null D/skia: — SkAndroidCodec::NewFromStream returned null W/unknown:ProgressiveDecoder: unknown image format, {uri: android.resource://com.google.android.googlequicksearchbox/2130903051, firstEncodedBytes: 03000800C80100000100, length: 456}
As seen in logs, it fails for applications like Chrome Browser, Docs, GMail, Google Calendar or even System keyboard
Reproduction
Just retrieve ApplicationInfo to access ApplicationInfo.icon class field, then parse the URI for such icon identifier and try to load:
LOADER
List<ApplicationInfo> appInfos = mPackageManager.getInstalledApplications(0);
LIST(RECYCLER)VIEW ADAPTER
ApplicationInfo info = appInfos.get(position);
if (info.icon != 0) {
Uri uri = Uri.parse("android.resource://" + packageName + "/" + info.icon);
holder.appIconSimpleDraweeView.setImageURI(uri);
}
Additional Information
- Fresco version: 1.10.0
- Platform version:
-
- Sony Xperia X Compact : Android Oreo 8.0.0
-
- Samsung Galaxy S8 : Android Oreo 8.0.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Fresco also supports custom decoder, so you can just add a custom decoder that handles the image properly (http://frescolib.org/docs/customizing-image-formats.html). Then, you don’t need to build from source but just experiment with a custom decoder in your app and make it work. And as Daniel mentioned, pull requests are welcome.
good @oprisnik