Skip to content

[Bug]: require()'d 3D models (.glb) fail to load on Android Release builds #4433

Closed

Description

@mfazekas

Mapbox Version

11.33.0 (default)

React Native Version

0.84.1

Platform

Android

@rnmapbox/maps version

main (8642d97), 10.3.16

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  Camera,
  LocationPuck,
  Models,
  ModelLayer,
  ShapeSource,
} from '@rnmapbox/maps';

const center = [-71.1, 42.34];
const car = require('./assets/sportcar.glb');

export default function BugReportExample() {
  return (
    <MapView style={{ flex: 1 }}>
      <Camera centerCoordinate={center} zoomLevel={18} pitch={50} />
      <LocationPuck model={{ uri: car, scale: [40, 40, 40] }} />
      <Models models={{ car }} />
      <ShapeSource id="src" shape={{ type: 'Point', coordinates: center }}>
        <ModelLayer id="layer" style={{ modelId: 'car', modelScale: [10, 10, 10] }} />
      </ShapeSource>
    </MapView>
  );
}

Any .glb works; the example app's example/src/assets/sportcar.glb was used (glb is already in the example's Metro assetExts). The Location Puck 3D and Simple Model Layer examples show the same thing in a Release build.

Observed behavior and steps to reproduce

  1. Build the app in Release (./gradlew assembleRelease) and run it on an Android device/emulator (tested on an Android 14 arm64 emulator).
  2. The 3D model never appears, neither for LocationPuck nor for ModelLayer. Logcat shows:
E/Mapbox  (30250): [maps-core]: Unknown model file type: src_assets_sportcar

In a Debug build served by Metro both render fine. Using an asset:// URL also works in Release (copy the file to android/app/src/main/assets/ and pass uri: 'asset://sportcar.glb' / models={{ car: 'asset://sportcar.glb' }}), which is the workaround for now.

Expected behavior

A model given with require(...) renders in Release just like in Debug.

Notes / preliminary analysis

In Release, React Native bundles non-image assets into res/raw, and Image.resolveAssetSource on Android returns only the resource name (src_assets_sportcar, no scheme, no extension). Both RNMBXNativeUserLocation.makeLocationPuck3D and RNMBXModels hand that string to Mapbox unchanged, and Mapbox can neither read raw resources nor guess the model format without an extension.

iOS should not be affected: there resolveAssetSource returns a file:// URL into the app bundle that keeps the .glb extension.

Additional links and references

Found while testing #4432.

Activity

  1. github-actions commented on Nov 4, 2026

    @github-actions

    Lint failed 😭

    Please fix the errors in your code example - More info.:

    error: './assets/sportcar.glb' module is restricted from being used. Repo example should complete - it should not use files from your project, use ../assets/example.png if you need an example image (node/no-restricted-require) at example.jsx:13:21:
      11 | 
      12 | const center = [-71.1, 42.34];
    > 13 | const car = require('./assets/sportcar.glb');
         |                     ^
      14 | 
      15 | export default function BugReportExample() {
      16 |   return (
    
    
    1 error found.```
    
  2. added 2 commits that reference this issue on Nov 4, 2026
    55bbdbb
    94f4ee4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions