Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
benjaminRomano opened this issue Mar 22, 2024 · 3 comments

Comments

@benjaminRomano
Copy link
Contributor

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
Copy link
Contributor Author

Fix here: #5388

@benjaminRomano
Copy link
Contributor Author

@sjudd friendly ping on this one

@benjaminRomano
Copy link
Contributor Author

@kanelbulle FYI in case you are owner nowadays

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant