Recently i have got java.lang.IllegalArgumentException: Invalid Transition types
.
This exception happens on android api 19 and it appeared after i have updated android build tools and support libraries to version 27.
Does anyone know what has changed with KitKat transitions?
Fragment fragment = new Fragment();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Transition transition = new AutoTransition();
fragment.setSharedElementEnterTransition(transition);
}
String backStateName = fragment.getClass().getName();
FragmentManager manager = getFragmentManager();
FragmentTransaction ft = manager.beginTransaction();
ft.addSharedElement(view, "TransitionView");
ft.replace(R.id.mainActivity_container, fragment, backStateName);
ft.addToBackStack(backStateName);
ft.commit();
Full exception:
Fatal Exception: java.lang.IllegalArgumentException: Invalid Transition types
at android.support.v4.app.FragmentTransition.chooseImpl(FragmentTransition.java:461)
at android.support.v4.app.FragmentTransition.configureTransitionsOrdered(FragmentTransition.java:3317)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2380)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2338)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2245)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:703)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5590)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java)
UPDATE
After changing from if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
to if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
I don't get exception.
androidx.*
transitions withandroid.*
transitions – Chaperon