margelo / margelo/react-native-vision-camera

resizer: Vulkan shader is not packaged with AGP 9 (shader sourceSet compilation removed)

Open
#4,183 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
9.6k
Forks
1.4k
Avg merge
1d 28m
Merged PRs (30d)
4

Description

What actually happened?

AGP 9 removed the built-in sourceSets.main.shaders compilation step, so with AGP 9 (RN 0.87 template / Gradle 9) react-native-vision-camera-resizer's Resizer.comp is never compiled and shaders/Resizer.comp.spv is missing from the APK. The first resize() on Android then throws from VulkanShaderAssetLoader because AAssetManager_open can't find the asset.

Steps to reproduce

Repro: any app on AGP 9.x using the resizer, call resize() on an Android device — fails on the shader load; the same code works on AGP 8.

What did you expect to happen?

Resizer.comp.spv is packaged in the APK and resize() works as it does on AGP 8.

Additional context

I've been running a local workaround: a Gradle Exec task in the resizer's android/build.gradle that invokes the NDK's glslc (shader-tools/<host>/glslc) at build time, writes the SPIR-V into a generated assets directory added to main.assets.srcDirs, and is wired as a dependency of every merge*Assets task. Happy to send that as a PR if it's the direction you'd like — or, if you'd rather not depend on the NDK's shader tools at build time, committing the compiled .spv as an asset is the other option.

Affected platforms

Android (device)

VisionCamera version

5.2.3 (react-native-vision-camera-resizer 5.2.3)

React Native version

0.87

React Native architecture

New Architecture (Fabric / bridgeless)

Features being used

Frame Processors (worklets)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the resizer's android/build.gradle and the Resizer.comp shader, then reproduce the missing shaders/Resizer.comp.spv asset with an AGP 9.x Android build. Review the reported shader-tools//glslc workaround and its generated assets and merge*Assets wiring. Done means the compiled shader is packaged in the APK and resize() works on an Android device.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, react-native
Domain
build-system, computer-graphics, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.