Repository navigation
Conversation
The bundle command copies a HEIC or HEIF asset into a `drawable-*` resource folder. The Android Gradle plugin accepts only XML, PNG, GIF, JPEG, BMP, WebP and AVIF files there, and fails the build on any other file with "The file name must end with .xml or .png", so a release build of an app that requires a HEIC image fails. Remove both types from `drawableFileTypes` so the assets go to `raw`, where any file is accepted. So that the image still resolves, `ResourceDrawableIdHelper.getResourceDrawableUri`, which turns an image source's resource name into a `res:` URI for Fresco, looks the name up among the raw resources when no drawable has it. A drawable keeps precedence over a raw resource with the same name. `getResourceDrawableId` and `getResourceDrawable` still resolve drawables only: their callers load the id as a drawable, which a raw resource is not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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:
drawableFileTypeslistsheicandheif, so the bundle command copies such an asset into adrawable-*resource folder. The Android Gradle plugin validates the files in those folders (FileResourceNameValidator) and accepts only.xml,.png,.9.png,.gif,.jpeg,.jpg,.bmp,.webpand.avif. Any other file fails resource merging with "The file name must end with .xml or .png", so a release build of an app that requires a HEIC image fails.This change removes both types from
drawableFileTypes, so the assets go toraw, where any file is accepted. An image is passed to native code by resource name, andResourceDrawableIdHelperlooked the name up only among drawables.getResourceDrawableUri, which turns an image source's name into theres:URI that Fresco loads, now looks among the raw resources when no drawable has the name, so the image still resolves. A drawable keeps precedence over a raw resource with the same name.The fallback is limited to that method.
getResourceDrawableIdandgetResourceDrawablestill resolve drawables only, because their callers (defaultSourceandloadingIndicatorSourceonImage,inlineImageLeftonTextInput, andImageLoaderModule) load the id as a drawable, and a raw resource of the same name, such as a JSON file, would throwResources.NotFoundExceptionthere. A HEIC image therefore works as an imagesourcebut not in those props.Density variants of a raw asset are not kept:
photo@2x.heicandphoto@3x.heicare both written toraw/photo.heic, as for other raw asset types.The fallback also applies to other image types that are bundled as raw resources because they are not in
drawableFileTypes, such as BMP.ktxstays in the list. AGP rejects it in the same way, but nothing in the open source image pipeline decodes it, and I left it alone.Changelog:
[ANDROID] [FIXED] - Package HEIC and HEIF image assets as raw resources so that release builds accept them
Test Plan:
AndroidPathUtils-test.jschecks thatheicandheifassets go toraw.AndroidPathUtils.jsreverted: 2 tests fail (Expected: "raw",Received: "drawable-mdpi").Also run:
yarn eslint --max-warnings 0andprettier --checkon the two changed JS files (clean),yarn flow-check(0 errors), ktfmt--dry-run --set-exit-if-changedon the two changed Kotlin files (clean),git diff --check(clean).The accepted extensions come from
javaponcom.android.utils.SdkUtilsandcom.android.ide.common.resources.FileResourceNameValidatorin thecommonandsdk-common32.2.1 jars, which AGP 9.2.1 uses.The Kotlin tests, run on this base (2026-11-28):
ResourceDrawableIdHelper.ktfrommainand the new tests kept: 8 tests, 1 failed (uriFallsBackToRawResourceForNameWithoutADrawable, which gets an empty URI).drawableIdIgnoresRawResources, which guards the callers that load drawables.Not run: a release build of an app with a HEIC asset, and showing the image on a device from a raw resource.
🤖 Generated with Claude Code