sceneform-android-sdk icon indicating copy to clipboard operation
sceneform-android-sdk copied to clipboard

Load GLTF model in SceneView from local without ARCore is failed: No RCB file at uri: null

Open viacheslavtitov opened this issue 7 years ago • 2 comments

App downloads model (GLTF) file from server and save it to local. After that app needs to display this model, but without ARCore. I try to render this model via ModelRenderable for getting model from local and display it in SceneView. My code is below:

private void loadModel(String filePath) {
        File file = new File((filePath));
        if(!file.exists() || file.isDirectory()) {
            Toast.makeText(this, R.string.error_file_not_exists,
                    Toast.LENGTH_LONG)
                    .show();
            return;
        }
        Callable<InputStream> callable = new Callable<InputStream>() {
            @Override
            public InputStream call() throws Exception {
                return new FileInputStream(file);
            }
        };
        ModelRenderable.builder()
                .setSource(this, callable)
                .setRegistryId(file)
                .build().thenAcceptAsync(new Consumer<ModelRenderable>() {
            @Override
            public void accept(ModelRenderable modelRenderable) {
                Timber.d("accept");
            }
        }).exceptionally(throwable -> {
            Timber.e(throwable);
            Toast.makeText(this, throwable.getMessage(), Toast.LENGTH_LONG).show();
            return null;
        })
                .whenComplete(new BiConsumer<Void, Throwable>() {
                    @Override
                    public void accept(Void aVoid, Throwable throwable) {
                        Timber.d("complete");
                        Timber.e(throwable);
                });
    }

E/ModelRenderable: Unable to load Renderable registryId='/storage/emulated/0/Android/data/com.moss.app/filesed47dc35c9d22af1f82e9349002f74f664cb49df0ed6a1a92d738d404b297264/unzip/mesh.gltf' java.util.concurrent.CompletionException: java.lang.AssertionError: No RCB file at uri: null at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:276) at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:282) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1627) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.AssertionError: No RCB file at uri: null at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.byteBufferToSfb(LoadRenderableFromSfbTask.java:191) at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0$LoadRenderableFromSfbTask(LoadRenderableFromSfbTask.java:121) at com.google.ar.sceneform.rendering.-$$Lambda$LoadRenderableFromSfbTask$0DkaOpfpmr8DYlbaxWogZtUpKTw.get(Unknown Source:4) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1625) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)  at java.lang.Thread.run(Thread.java:764)  2019-11-22 13:49:09.685 9890-12344/com.moss.app E/AssetViewerActivity: java.util.concurrent.CompletionException: java.lang.AssertionError: No RCB file at uri: null at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:276) at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:282) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1627) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.AssertionError: No RCB file at uri: null at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.byteBufferToSfb(LoadRenderableFromSfbTask.java:191) at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0$LoadRenderableFromSfbTask(LoadRenderableFromSfbTask.java:121) at com.google.ar.sceneform.rendering.-$$Lambda$LoadRenderableFromSfbTask$0DkaOpfpmr8DYlbaxWogZtUpKTw.get(Unknown Source:4) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1625) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)  at java.lang.Thread.run(Thread.java:764) 

File exists. Before it I check to permission WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE. I use last versions of libraries:

implementation 'com.google.ar:core:1.13.0' implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.13.0' implementation 'com.google.ar.sceneform:core:1.13.0' implementation 'com.google.ar.sceneform:assets:1.13.0'

Testing on Android 8.0 Samsung 7 Edge Model is very simple (just 3.1Mb). I tried to test with other models but got similar errors. This models good display ARKit via SceneKit.

viacheslavtitov avatar Nov 22 '19 11:11 viacheslavtitov

Hi I'm having the same issue? Did you find a fix?

ca-aditi-arora avatar Dec 17 '19 09:12 ca-aditi-arora

Hi I'm having the same issue? Did you find a fix?

No, I didn't. But I found what is the problem. As I am understand if model resources are in one file that Sceneform loads all resources in memory and app crashes with OutOfMemoryException. We changed server models and I downloads separate files (models and resources for this models). By this way Sceneform loads model correctly and app doesn't crash.

viacheslavtitov avatar Dec 17 '19 09:12 viacheslavtitov