google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.98k stars 1.22k forks source link

Android Views freezing inside ViewRenderable #901

Closed victormun closed 4 years ago

victormun commented 5 years ago

Hello guys,

I'm facing some issues related to Android Views and ViewRenderables. Whenever I try to instantiate a Node with a ViewRenderable, there seems to be some kind of freezing going on that makes the view unusable.

For example, let's say I create a Node and a ViewRenderable containing a RecyclerView. After 1-2 seconds scrolling, it freezes and never moves again. This issue only happens when scrolling. If you use a pair of buttons to scroll through the list, it never freezes. But once you start scrolling with the finger, it just freezes completely.

By "freezing", I mean that the View remains still and doesn't change colors or texts inside of it and, in case it freezes while overscrolling, the overscrolling effect stays on the view forever.

The exact same issue happens to me with the Solar System sceneform sample.

Node infoCard = new Node();
infoCard.setParent(infocardBaseNode);
ViewRenderable.builder()
                .setView(context, R.layout.list_card)
                .setSizer(new DpToMetersViewSizer(DP_PER_METERS))
                .build()
                .thenAccept(
                        (renderable) -> {
                            View listView = renderable.getView();
                            CardView baseLayout = listView.findViewById(R.id.base_layout);
                            recyclerView = listView.findViewById(R.id.recyclerview);
                            recyclerView.setHasFixedSize(true);
                            LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
                            recyclerView.setLayoutManager(mLayoutManager);
                            recyclerView.setAdapter(new Adapter(mList));
                            infoCard.setRenderable(renderable);
                        })
                .exceptionally(
                        (throwable) -> {
                            throw new AssertionError("Could not load card view.", throwable);
                        });

VERSIONS USED

victormun commented 5 years ago

After doing some further research, I've discovered that this happens when the project uses an ARCore version higher than 1.3.0.

If you clone the Sceneform Solar System project with the 1.3.0 tag, the solar control sliders will work perfectly. However, if you increase the ARCore version to 1.4.0, you will find that these controls will be frozen after 1-2 seconds of usage.

Is there a workaround? Thanks!

victormun commented 4 years ago

This has been fixed in version 1.15.0.