Scene transition with hero elements throws Layer exceeds max. dimensions supported by the GPU Scene transition with hero elements throws Layer exceeds max. dimensions supported by the GPU android android

Scene transition with hero elements throws Layer exceeds max. dimensions supported by the GPU


The Fade transition will use hardware layers when your view does has "hasOverlappingRendering()" return true. This was done for performance. You must have many views all fading out separately.

You have a couple options. One is for your views to have hasOverlappingRendering return false. This may not be possible in all cases, but it may be enough to solve your problem. Remember that this means that the contained views should not overlap!

The second is to transition fewer views separately. You can do this by setting android:transitionGroup="true" on ViewGroups that should be faded out together. For example, if you have a ListView with no background, you'll end up transitioning each element separately. Instead, you can set the ListView's transitionGroup property to true and then they'll transition together.

-- update --

The problem you're encountering is that the incoming Views that are fading in are too large. I tried the following View in the launching Activity:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:onClick="clicked"    >    <TextView        android:id="@+id/hello_world"        android:transitionName="hello"        android:text="@string/hello_world"        android:layout_width="wrap_content"        android:layout_height="wrap_content" /></RelativeLayout>

Yes, the hello world basic app from android, giving an id and transitionName to the text. The onClick handler just launches the second Activity, passing the hello world View as a shared element. The second Activity has an extremely large TextView, similar to yours:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:transitionGroup="true"    >    <RelativeLayout        android:layout_width="match_parent"        android:layout_height="wrap_content">        <TextView            android:id="@+id/hello_world"            android:transitionName="hello"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignParentRight="true"            android:text="@string/hello_world" />        <TextView            android:layout_below="@+id/hello_world"            android:text="Lorem ipsum.... I didn't copy all of my text"            android:textSize="30sp"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            />    </RelativeLayout></ScrollView>

Switching the ScrollView's transitionGroup from false (the default value) to true makes it work because then the ScrollView is being faded in. The ScrollView has a maximum size, while its contents can be enormous.


The root cause of this issue is indicated in your log on this line:

W/OpenGLRenderer(18137): Layer exceeds max. dimensions supported by the GPU (1080x4628, max=4096x4096).

Your target activity has a height of 4628 which is greater than the maximum supported by the GPU - 4096.

The solution, already mentioned in the other answer, is to create a target activity which is shorter. Similar question and answer here: crash - material design android 5.0


You can just avoid it if the fade transition isn't a must: see here for detail: https://stackoverflow.com/a/45030173/4334399