fix(android): Fall back to compiled_item ref ID for AAB resource resolution#572
Merged
runningcode merged 2 commits intomainfrom Mar 3, 2026
Merged
fix(android): Fall back to compiled_item ref ID for AAB resource resolution#572runningcode merged 2 commits intomainfrom
runningcode merged 2 commits intomainfrom
Conversation
…lution When an AAB manifest attribute has a string value like "@string/app_name_bootstrap" that doesn't match any entry in the protobuf resource table, the code now falls back to resolving via the compiled_item's reference ID instead of returning None. This fixes apps (e.g. ING Banking) where the manifest label references a resource name that doesn't exist in resources.pb, but the numeric resource ID in compiled_item.ref.id resolves correctly.
chromy
reviewed
Mar 2, 2026
|
|
||
| # Key-based lookup failed, fall back to compiled_item ref ID | ||
| logger.debug(f"key-based lookup failed for {value}, trying compiled_item ref") | ||
| compiled_item = getattr(attribute, "compiled_item", None) |
Contributor
There was a problem hiding this comment.
I don't think the getattr is right here. The generated interface (Resources_pb2.pyi) implies it will always exist as a field on the object.
I think the right thing is either:
compiled_item = attribute.compiled_item if attribute.HasField("compiled_item") else None
If we need to handle this being unset, or:
compiled_item = attribute.compiled_item
if not.
Use the idiomatic protobuf HasField() instead of getattr() since compiled_item is a defined field on the proto message and always exists as an attribute. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
valuestring like@string/app_name_bootstrapthat doesn't match any entry in the protobuf resource table, the code now falls back to resolving via thecompiled_item.ref.idinstead of returningNone.resources.pb, but the numeric resource ID incompiled_item.ref.idresolves correctly.Root Cause
In
_get_optional_attr_value(), whenattribute.valuestarts with@, it callsget_value_by_key()for a name-based lookup and directly returns the result — even ifNone. It never tries thecompiled_item.ref.idpath which resolves by numeric resource ID.Production logs for a failing artifact:
The resource ID-based lookup would have succeeded, but was never attempted.
Fixes EME-900