bumptech / glide

An image loading and caching library for Android focused on smooth scrolling
https://bumptech.github.io/glide/
Other
34.67k stars 6.12k forks source link

Drawable Resources are not properly loaded when resource names are stripped out from Resource Table #5389

Closed benjaminRomano closed 6 months ago

benjaminRomano commented 7 months ago

Description

We are working on enabling the collapse names optimization of aapt2 that removes the resource names from the Resource Table as an app size optimization. However, once enabled, we ran into issues loading resources.

One requirement of removing resource names from the Resource Table is ensuring that resources are not referenced by resource name when loaded. If they are referenced by resource name, they must be explicitly kept with keep rules. (ref).

ResourceLoader is using the android.resource://<package_name>/<resource_type>/<resource_name> content URI to resolve Drawable resources, which is incompatible with collapse names optimization.

Fortunately, the ContentResolver for resources has another URI scheme that enables loading resources without referencing the name: android.resource://<package_name>/<resource_id>, which can be used instead (ref).

benjaminRomano commented 7 months ago

Fix here: https://github.com/bumptech/glide/pull/5388

benjaminRomano commented 7 months ago

@sjudd friendly ping on this one

benjaminRomano commented 7 months ago

@kanelbulle FYI in case you are owner nowadays