Skip to content

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

Description

@jslok

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions