GLB Asset Loading Fails on Android with Undefined ‘match’ Error
Environment
- Expo Version: 51.0.39
- React Native Version: 0.74.5
- Platform: Android
- Reproduction Method:
expo run:android
Description
When attempting to load a compressed GLB file in a React Native Expo project, an error occurs on Android that prevents the asset from loading:
ERROR Error: Could not load http://10.0.2.2:8082/assets/?unstable_path=.%2Fassets%2Fmodels/output.glb?platform=android&hash=80c4e5d9a2989da95b359e712a6197f5: Cannot read property 'match' of undefined
Steps to Reproduce
- Compress a GLB file using
gltf-transform optimize input.glb output.glb --texture-compress webp
- Place the compressed GLB in the project’s assets folder
- Use the following code to load the asset:
const AvaPath = Asset.fromModule(require('../../assets/models/output.glb')).uri; export function Ava({ words, replay, setReplay }) { const group = React.useRef(); const { nodes, materials } = useLoader(GLTFLoader, AvaPath, (loader) => { loader.setMeshoptDecoder(MeshoptDecoder); }); }
- Run the project with
expo run:android
Expected Behavior
The GLB file should load successfully on Android, similar to how it works on web (expo start --web
).
Actual Behavior
Loading fails with an undefined ‘match’ error, preventing the asset from being displayed.
Debugging Steps Attempted
- Verified asset path
- Confirmed web loading works correctly
- Checked dependencies and versions
Relevant Dependencies
expo-asset
: 10.0.10expo-file-system
: 17.0.1meshoptimizer
: 0.22.0three
: 0.169.0
Potential Areas of Investigation
- Asset loading mechanism differences between web and Android
- Compatibility of compressed GLB with React Native asset system
- Potential issues with
Asset.fromModule()
on Android
Additional Notes
- The same GLB file works correctly when running on web
- File was compressed from 1GB to 20MB using
gltf-transform
Reproducibility
✓ Consistently Reproducible
Request
Could maintainers provide guidance on:
- Proper asset loading for compressed GLB files in React Native/Expo
- Potential workarounds for this loading issue
- Known compatibility issues with GLB assets
/cc @expo/expo @react-three/fiber