google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 603 forks source link

Load 3d models at runtime #531

Open codewithlester opened 5 years ago

codewithlester commented 5 years ago

Seems like the example of the loading 3d models at runtime is not working. example Can provide a working sample for it ? Thank you.

khonakr commented 5 years ago

Even I cannot seem to get it working. (v1.7.0)

Here is the stack trace: 2019-02-15 11:33:16.566 14456-14533/com.google.ar.sceneform.samples.hellosceneform E/ModelRenderable: Unable to load Renderable registryId='https://github.com/KhronosGroup/glTF-Sample-Models/raw/master/2.0/Duck/glTF/Duck.gltf' java.util.concurrent.CompletionException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/io/Files; 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:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/io/Files; at com.google.ar.sceneform.assets.RenderableSource.call(SourceFile:15) at com.google.ar.sceneform.assets.RenderableSource.call(SourceFile:73) at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.inputStreamToByteBuffer(LoadRenderableFromSfbTask.java:178) at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0(LoadRenderableFromSfbTask.java:113) 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:1167)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)  at java.lang.Thread.run(Thread.java:764)  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.common.io.Files" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.google.ar.sceneform.samples.hellosceneform-UXiS6VTurYH-WktM9IePwg==/base.apk"],nativeLibraryDirectories=[/data/app/com.google.ar.sceneform.samples.hellosceneform-UXiS6VTurYH-WktM9IePwg==/lib/arm64, /data/app/com.google.ar.sceneform.samples.hellosceneform-UXiS6VTurYH-WktM9IePwg==/base.apk!/lib/arm64-v8a, /system/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.google.ar.sceneform.assets.RenderableSource.call(SourceFile:15)  at com.google.ar.sceneform.assets.RenderableSource.call(SourceFile:73)  at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.inputStreamToByteBuffer(LoadRenderableFromSfbTask.java:178)  at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0(LoadRenderableFromSfbTask.java:113)  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:1167)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)  at java.lang.Thread.run(Thread.java:764) 

codewithlester commented 5 years ago

@khonakr Yes exactly. They always say that we refer to the example but it’s not working. Cannot go forward for the issue.

khonakr commented 5 years ago

Until then you can still use 'com.google.ar.sceneform:assets:1.6.0' with 'com.google.ar.sceneform:core:1.7.0' unless you specifically need something from 1.7.0 assets.

tpsiaki commented 5 years ago

Thanks for the report. We will look into this.

RichardSantillan commented 5 years ago

Any update on this issue?

sandeep415 commented 5 years ago

I'm facing same issue. Not able to load the 3D model from server. Getting following error

java.util.concurrent.CompletionException: java.lang.RuntimeException: Failed to import '/data/user/0/com.viveksb007.arhr/cache/1557239306422-0/model_source.gltf' at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.inputStreamToByteBuffer(LoadRenderableFromSfbTask.java:181) at com.google.ar.sceneform.rendering.LoadRenderableFromSfbTask.lambda$downloadAndProcessRenderable$0(LoadRenderableFromSfbTask.java:113) 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)

FazalJarral commented 4 years ago

Poly Runtime Api only works with "GLTF" format. Anyother format will return error Unable to load Renderable registryId

RichardSantillan commented 4 years ago

I was using GLTF back then, seems this was resolved with the sceneform update that happened after my post

FazalJarral commented 4 years ago

I was using GLTF back then, seems this was resolved with the sceneform update that happened after my post

Nope , For me , If i use formattype of GLTF2 , runtime api works fine. Any other format throws error.

1AhsanSyed commented 4 years ago

i'm not able to load my 3D model runtime, my model is GLTF type model. kindly help me ASAP it's not crashing my app but still not able to load the 3D model

some of the errors are:

Caused by: java.io.FileNotFoundException: http://abc.example.pk/CONTENT/PRODUCT/MODELS/model23329.gltf

E/ModelRenderable: Unable to load Renderable registryId='/CONTENT/PRODUCT/MODELS/model23329.gltf'

java.util.concurrent.CompletionException: java.util.concurrent.CompletionException: java.io.FileNotFoundException: http://abc.example.pk/CONTENT/PRODUCT/MODELS/model23329.gltf
tpsiaki commented 4 years ago

The error indicates that your url isn't accessible. Have you double-checked that you can access that link from inside your app? When I click it it fails dns lookup.

1AhsanSyed commented 4 years ago

i posted my problem on stackoverflow if your can solved my problem so here it is : https://stackoverflow.com/questions/60901493/not-able-to-load-my-3d-objectgltf-at-run-time