Accidente de transición de elemento compartido para dispositivos Lollipop

Estoy utilizando la API ActivityOptions.makeSceneTransitionAnimation para manejar transiciones compartidas.

El problema que estoy enfrentando es que funciona en dispositivos Marshmellow, pero se bloquea en dispositivos Lolipop.

Este es el registro del accidente:

 Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.ViewGroup.getScrollX()' on a null object reference at android.app.ActivityTransitionCoordinator.setSharedElementState(ActivityTransitionCoordinator.java:435) at android.app.ActivityTransitionCoordinator.setSharedElementState(ActivityTransitionCoordinator.java:473) at android.app.EnterTransitionCoordinator.startSharedElementTransition(EnterTransitionCoordinator.java:332) at android.app.EnterTransitionCoordinator.access$200(EnterTransitionCoordinator.java:42) at android.app.EnterTransitionCoordinator$5$1.run(EnterTransitionCoordinator.java:389) at android.app.ActivityTransitionCoordinator.startTransition(ActivityTransitionCoordinator.java:698) at android.app.EnterTransitionCoordinator$5.onPreDraw(EnterTransitionCoordinator.java:386) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1990) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1088) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5825) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:769) at android.view.Choreographer.doCallbacks(Choreographer.java:582) at android.view.Choreographer.doFrame(Choreographer.java:552) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:755) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5237) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707) 

Aquí está mi código

  @Override public void getComments(String postId, String authorName, String message, String imageURL, String likesCount, RelativeLayout imageView) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && imageView != null) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getActivity(), imageView, "revealLayout"); Intent commentIntent = new Intent(getActivity(), CommentsActivity.class); commentIntent.putExtra("postId", postId); commentIntent.putExtra("authorName", authorName); commentIntent.putExtra("message", message); commentIntent.putExtra("imageURL", imageURL); commentIntent.putExtra("likesCount", likesCount); startActivity(commentIntent, options.toBundle()); } else { Intent commentIntent = new Intent(getActivity(), CommentsActivity.class); commentIntent.putExtra("postId", postId); commentIntent.putExtra("authorName", authorName); commentIntent.putExtra("message", message); commentIntent.putExtra("imageURL", imageURL); commentIntent.putExtra("likesCount", likesCount); startActivity(commentIntent); } } 

Estoy recibiendo los datos anteriores de un adaptador de devolución de llamada a través de interfaz

Mi XML:

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root_layout" android:layout_width="match_parent" android:transitionName="revealLayout" android:layout_height="wrap_content" android:background="?android:attr/selectableItemBackground" android:orientation="vertical"> 

La misma disposición relativa con android:transitionName en el extremo receptor

Este es mi styles.xml

  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">#c65643</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:windowContentTransitions">true</item> <item name="android:windowSharedElementReenterTransition">@null</item> <item name="android:windowReenterTransition">@null</item> <item name="android:windowAllowReturnTransitionOverlap">false</item> </style> 

También styles.xml (21)

  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">#c65643</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:windowContentTransitions">true</item> <item name="android:windowSharedElementReenterTransition">@null</item> <item name="android:windowReenterTransition">@null</item> <item name="android:windowAllowReturnTransitionOverlap">false</item> </style> 

También pasó por este enlace https://code.google.com/p/android/issues/detail?id=224270&sort=-id&colspec=ID pero no hay suerte

Gracias por adelantado

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.