google-ar / sceneform-android-sdk

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

Load Runtime Model : Failed resolution of: Lcom/google/common/io/Files #560

Open eddydn opened 5 years ago

eddydn commented 5 years ago

When i use load runtime Model 3D , i have error and this exception have show in my log cat

This is my code :

ModelRenderable.builder() .setSource(MainActivity.this, RenderableSource.builder().setSource( MainActivity.this, Uri.parse(GLTF_ASSET), RenderableSource.SourceType.GLTF2).build()) .setRegistryId(GLTF_ASSET) .build() .thenAccept(modelRenderable -> {

                        Anchor anchor = hitResult.createAnchor();
                        AnchorNode anchorNode = new AnchorNode(anchor);
                        anchorNode.setParent(arFragment.getArSceneView().getScene());

                        createModel(anchorNode,modelRenderable);

                    }).exceptionally(
                    throwable -> {
                        Log.d("ERROR3D",throwable.getMessage());
                        Toast toast =
                                Toast.makeText(MainActivity.this, "Unable to load renderable " +
                                        GLTF_ASSET, Toast.LENGTH_LONG);
                        toast.setGravity(Gravity.CENTER, 0, 0);
                        toast.show();
                        return null;
                    });

I'm use Sceneform 1.7.0 version

GianpaMX commented 5 years ago

I spent a lot of hours dealing with this error, I believe 1.7 depends on guava but it is not included as a transitive dependency so gradle can't resolve it.

If you try to add it as a direct dependency of your project; it won't compile due to a lot of class files from other dependencies are included in 1.7 like j2objc.annotations or org.checkerframework

This is the content of 1.5

assets-1.5.0.aar
├── AndroidManifest.xml
├── R.txt
├── classes.jar
│   └── com
│       └── google
│           ├── ar
│           │   └── sceneform
│           │       └── assets
│           │           ├── Converter$a.class
│           │           ├── Converter.class
│           │           ├── RenderableSource$1.class
│           │           ├── RenderableSource$Builder.class
│           │           ├── RenderableSource$RecenterMode.class
│           │           ├── RenderableSource$SourceType.class
│           │           └── RenderableSource.class
│           └── sceneform_assets
│               ├── A.class
│               ├── B.class
│               ├── c.class
│               ├── d.class
│               ├── e.class
│               ├── f.class
│               ├── g.class
│               ├── h.class
│               ├── i.class
│               ├── j.class
│               ├── k.class
│               ├── l.class
│               ├── m.class
│               ├── n.class
│               ├── o.class
│               ├── p.class
│               ├── q.class
│               ├── r.class
│               ├── s.class
│               ├── t.class
│               ├── u.class
│               ├── v.class
│               ├── w.class
│               ├── x.class
│               ├── y.class
│               └── z.class
├── jni
│   ├── arm64-v8a
│   │   └── libconverter_jni.so
│   ├── armeabi-v7a
│   │   └── libconverter_jni.so
│   └── x86
│       └── libconverter_jni.so
├── proguard.txt
└── res

This is the content of 1.7

assets-1.7.0.aar
├── AndroidManifest.xml
├── R.txt
├── classes.jar
│   ├── com
│   │   └── google
│   │       ├── ar
│   │       │   └── sceneform
│   │       │       └── assets
│   │       │           ├── Converter$a.class
│   │       │           ├── Converter.class
│   │       │           ├── RenderableSource$1.class
│   │       │           ├── RenderableSource$Builder.class
│   │       │           ├── RenderableSource$RecenterMode.class
│   │       │           ├── RenderableSource$SourceType.class
│   │       │           └── RenderableSource.class
│   │       └── j2objc
│   │           └── ...
│   ├── javax
│   │   └── annotation
│   │       ├── ...
│   └── org
│       └── checkerframework
│           ├── ...
├── jni
│   ├── arm64-v8a
│   │   └── libconverter_jni.so
│   ├── armeabi-v7a
│   │   └── libconverter_jni.so
│   ├── x86
│   │   └── libconverter_jni.so
│   └── x86_64
│       └── libconverter_jni.so
├── proguard.txt
└── res

downgrading to 1.5 works

fxsalazar commented 5 years ago

The issue is specific to com.google.ar.sceneform:assets; using assets:1.6.0 and the others with 1.7 solved my problem.

fxsalazar commented 5 years ago

You might change the issue's title to be more on point.