Unable to load GLTF model in android release mode, but working fine in debug mode

thanks in advance

A repro would really help to better understand what is happening as well as if you use babylon native or react native ?

cc @BabylonNative

I am trying load to local GLTB in my react native project. It’s working in Android debug build, but GLTF model is not loading in “Release Build”.
I am converting my local model file path into “http” uri using resolveAssetSource.
In degub, file path is coming correct “http” format, but in release mode file path coming like “Assets_3DModels_basic_sci-fi_crate_screne1.gltf”
Do you how to get file path in “http” format in android release mode.
Is there any way to load model in android release build?

I shared my code below

import resolveAssetSource from ‘react-native/Libraries/Image/resolveAssetSource’;

const sceneGLBUri = resolveAssetSource(“…/…/Assets/3DModels/basic_sci-fi_crate/scene1.gltf”).uri;
const { meshes, animationGroups } = await SceneLoader.ImportMeshAsync(
“”,
sceneGLBUri,
“”,
scene
);

Maybe this discussion helps you, it is including your case with Android Release mode:

This is how it is implemented in Space Pirates via require(…):

I have tried exo-assest Gltf is working debug mode, it’s not working in release mode.
but glb working fine both debug and release mode.

Hi @sebavan @Takemura Do you have idea about babylon js apps in playstore. using gltf models.

cc @Cedric and @bghgary

Yes, it’s a known issue…still on the radar with no ETA yet.

1 Like

@Cedric @bghgary Any updates?

No, sorry. Still on my radar though.

Just to check, any update/fixes on this? Right now I’m using React Native 0.72.3 and @babylonjs/react-native 1.6.3. But the model is not showing on Android release mode. It’s working on Debug mode.
I also tried using .glb file and assign the path to {uri: "assets/model.glb"} instead of using require("./model.glb) but it is still not showing.

I know. It’s still on our todo list.
There is this issue : importing a .glb file fails if only local path is provided and not served through HTTP ¡ Issue #165 ¡ BabylonJS/BabylonReactNative ¡ GitHub

I keep updating it with new workarounds.

@Cedric any updates on the workarounds?

no new update. did you try those provided in the github issue?

oh I havent tried them all. just checked, will try them out. thanks Cedric!

1 Like