As many of you already know, AR libraries are currently at version 1.17.1. Since Android studio import plugin is deprecated, I have a hard time importing and using models in my AR scene.
Currently I have 2 .gltf models in my raw folder and I have the following code trying to show a model in the screen :
ModelRenderable.builder()
.setSource(context.applicationContext, context.resources.getIdentifier(name, "raw", context.packageName))
.build()
.thenAccept {
renderable = it
}
.exceptionally {
print("Error : $it")
null
}
When I try to add the model, I am getting the following exception :
2020-12-01 17:34:27.012 24894-26864/com.inform.ar E/ModelRenderable: Unable to load Renderable registryId='android.resource://com.inform.ar/raw/armchair'
java.util.concurrent.CompletionException: java.lang.AssertionError: No RCB file at uri: android.resource://com.inform.ar/raw/armchair
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:278)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:284)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1629)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.AssertionError: No RCB file at uri: android.resource://com.inform.ar/raw/armchair
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$A8YYsoT3V_A--F80fBJ_ZLNSnhc.get(Unknown Source:4)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1627)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
What is wrong with this code? There are no official tutorials that are updated. All demos are not working properly and most of the tutorials are using the plugin to import models. Do any of you have any ideas how to make this work?