Android java.lang.IllegalArgumentException: Invalid Transition types












3















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.










share|improve this question





























    3















    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.










    share|improve this question



























      3












      3








      3








      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.










      share|improve this question
















      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.







      android exception android-4.4-kitkat transitions






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '18 at 10:25







      Martynas

















      asked Apr 13 '18 at 8:26









      MartynasMartynas

      286




      286
























          4 Answers
          4






          active

          oldest

          votes


















          2














          check your fragment import like below..



          import android.support.v4.app.Fragment;


          if you used addSharedElement make change in app level gradle file api level 21.



               minSdkVersion 21





          share|improve this answer
























          • Yes, I'm using correct import and i cant set minSdkVersion to 21 because i need to support my app to lower api devices. Also the same code worked before build tools and support libraries update

            – Martynas
            Apr 13 '18 at 8:41













          • that time you need to define annotation for particular method like @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

            – Android Team
            Apr 13 '18 at 8:44











          • particular features work for particular api.

            – Android Team
            Apr 13 '18 at 8:45











          • So what i need to do to make transitions work beginning with api19.

            – Martynas
            Apr 13 '18 at 8:50











          • transitions will be work main things addSharedElement is need api 21.

            – Android Team
            Apr 13 '18 at 8:51



















          2














          Looking at the change here it looks like it should probably read 'must' use support transitions rather than 'can' use them. Try changing your AutoTransition from android.transition.AutoTransition to android.support.transition.AutoTransition and it should work perfectly without needing any SDK version checks.






          share|improve this answer































            0














            You are mixing transitions from the support library and the platform.
            For example.:



            import android.support.transition.AutoTransition;
            import android.transition.Fade;


            Change that to only use support library, like this:



            import android.support.transition.AutoTransition;
            import android.support.transition.Fade;





            share|improve this answer































              0














              After switching to androidX, I got this error because some import was from




              android.package




              and some from




              androidx.package







              share|improve this answer























                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49812508%2fandroid-java-lang-illegalargumentexception-invalid-transition-types%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                2














                check your fragment import like below..



                import android.support.v4.app.Fragment;


                if you used addSharedElement make change in app level gradle file api level 21.



                     minSdkVersion 21





                share|improve this answer
























                • Yes, I'm using correct import and i cant set minSdkVersion to 21 because i need to support my app to lower api devices. Also the same code worked before build tools and support libraries update

                  – Martynas
                  Apr 13 '18 at 8:41













                • that time you need to define annotation for particular method like @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

                  – Android Team
                  Apr 13 '18 at 8:44











                • particular features work for particular api.

                  – Android Team
                  Apr 13 '18 at 8:45











                • So what i need to do to make transitions work beginning with api19.

                  – Martynas
                  Apr 13 '18 at 8:50











                • transitions will be work main things addSharedElement is need api 21.

                  – Android Team
                  Apr 13 '18 at 8:51
















                2














                check your fragment import like below..



                import android.support.v4.app.Fragment;


                if you used addSharedElement make change in app level gradle file api level 21.



                     minSdkVersion 21





                share|improve this answer
























                • Yes, I'm using correct import and i cant set minSdkVersion to 21 because i need to support my app to lower api devices. Also the same code worked before build tools and support libraries update

                  – Martynas
                  Apr 13 '18 at 8:41













                • that time you need to define annotation for particular method like @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

                  – Android Team
                  Apr 13 '18 at 8:44











                • particular features work for particular api.

                  – Android Team
                  Apr 13 '18 at 8:45











                • So what i need to do to make transitions work beginning with api19.

                  – Martynas
                  Apr 13 '18 at 8:50











                • transitions will be work main things addSharedElement is need api 21.

                  – Android Team
                  Apr 13 '18 at 8:51














                2












                2








                2







                check your fragment import like below..



                import android.support.v4.app.Fragment;


                if you used addSharedElement make change in app level gradle file api level 21.



                     minSdkVersion 21





                share|improve this answer













                check your fragment import like below..



                import android.support.v4.app.Fragment;


                if you used addSharedElement make change in app level gradle file api level 21.



                     minSdkVersion 21






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 13 '18 at 8:36









                Android TeamAndroid Team

                7,53011033




                7,53011033













                • Yes, I'm using correct import and i cant set minSdkVersion to 21 because i need to support my app to lower api devices. Also the same code worked before build tools and support libraries update

                  – Martynas
                  Apr 13 '18 at 8:41













                • that time you need to define annotation for particular method like @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

                  – Android Team
                  Apr 13 '18 at 8:44











                • particular features work for particular api.

                  – Android Team
                  Apr 13 '18 at 8:45











                • So what i need to do to make transitions work beginning with api19.

                  – Martynas
                  Apr 13 '18 at 8:50











                • transitions will be work main things addSharedElement is need api 21.

                  – Android Team
                  Apr 13 '18 at 8:51



















                • Yes, I'm using correct import and i cant set minSdkVersion to 21 because i need to support my app to lower api devices. Also the same code worked before build tools and support libraries update

                  – Martynas
                  Apr 13 '18 at 8:41













                • that time you need to define annotation for particular method like @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

                  – Android Team
                  Apr 13 '18 at 8:44











                • particular features work for particular api.

                  – Android Team
                  Apr 13 '18 at 8:45











                • So what i need to do to make transitions work beginning with api19.

                  – Martynas
                  Apr 13 '18 at 8:50











                • transitions will be work main things addSharedElement is need api 21.

                  – Android Team
                  Apr 13 '18 at 8:51

















                Yes, I'm using correct import and i cant set minSdkVersion to 21 because i need to support my app to lower api devices. Also the same code worked before build tools and support libraries update

                – Martynas
                Apr 13 '18 at 8:41







                Yes, I'm using correct import and i cant set minSdkVersion to 21 because i need to support my app to lower api devices. Also the same code worked before build tools and support libraries update

                – Martynas
                Apr 13 '18 at 8:41















                that time you need to define annotation for particular method like @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

                – Android Team
                Apr 13 '18 at 8:44





                that time you need to define annotation for particular method like @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

                – Android Team
                Apr 13 '18 at 8:44













                particular features work for particular api.

                – Android Team
                Apr 13 '18 at 8:45





                particular features work for particular api.

                – Android Team
                Apr 13 '18 at 8:45













                So what i need to do to make transitions work beginning with api19.

                – Martynas
                Apr 13 '18 at 8:50





                So what i need to do to make transitions work beginning with api19.

                – Martynas
                Apr 13 '18 at 8:50













                transitions will be work main things addSharedElement is need api 21.

                – Android Team
                Apr 13 '18 at 8:51





                transitions will be work main things addSharedElement is need api 21.

                – Android Team
                Apr 13 '18 at 8:51













                2














                Looking at the change here it looks like it should probably read 'must' use support transitions rather than 'can' use them. Try changing your AutoTransition from android.transition.AutoTransition to android.support.transition.AutoTransition and it should work perfectly without needing any SDK version checks.






                share|improve this answer




























                  2














                  Looking at the change here it looks like it should probably read 'must' use support transitions rather than 'can' use them. Try changing your AutoTransition from android.transition.AutoTransition to android.support.transition.AutoTransition and it should work perfectly without needing any SDK version checks.






                  share|improve this answer


























                    2












                    2








                    2







                    Looking at the change here it looks like it should probably read 'must' use support transitions rather than 'can' use them. Try changing your AutoTransition from android.transition.AutoTransition to android.support.transition.AutoTransition and it should work perfectly without needing any SDK version checks.






                    share|improve this answer













                    Looking at the change here it looks like it should probably read 'must' use support transitions rather than 'can' use them. Try changing your AutoTransition from android.transition.AutoTransition to android.support.transition.AutoTransition and it should work perfectly without needing any SDK version checks.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 14 '18 at 8:54









                    user3265561user3265561

                    332118




                    332118























                        0














                        You are mixing transitions from the support library and the platform.
                        For example.:



                        import android.support.transition.AutoTransition;
                        import android.transition.Fade;


                        Change that to only use support library, like this:



                        import android.support.transition.AutoTransition;
                        import android.support.transition.Fade;





                        share|improve this answer




























                          0














                          You are mixing transitions from the support library and the platform.
                          For example.:



                          import android.support.transition.AutoTransition;
                          import android.transition.Fade;


                          Change that to only use support library, like this:



                          import android.support.transition.AutoTransition;
                          import android.support.transition.Fade;





                          share|improve this answer


























                            0












                            0








                            0







                            You are mixing transitions from the support library and the platform.
                            For example.:



                            import android.support.transition.AutoTransition;
                            import android.transition.Fade;


                            Change that to only use support library, like this:



                            import android.support.transition.AutoTransition;
                            import android.support.transition.Fade;





                            share|improve this answer













                            You are mixing transitions from the support library and the platform.
                            For example.:



                            import android.support.transition.AutoTransition;
                            import android.transition.Fade;


                            Change that to only use support library, like this:



                            import android.support.transition.AutoTransition;
                            import android.support.transition.Fade;






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 16 '18 at 15:24









                            Jacob NordfalkJacob Nordfalk

                            2,9881518




                            2,9881518























                                0














                                After switching to androidX, I got this error because some import was from




                                android.package




                                and some from




                                androidx.package







                                share|improve this answer




























                                  0














                                  After switching to androidX, I got this error because some import was from




                                  android.package




                                  and some from




                                  androidx.package







                                  share|improve this answer


























                                    0












                                    0








                                    0







                                    After switching to androidX, I got this error because some import was from




                                    android.package




                                    and some from




                                    androidx.package







                                    share|improve this answer













                                    After switching to androidX, I got this error because some import was from




                                    android.package




                                    and some from




                                    androidx.package








                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 22 '18 at 10:26









                                    Ostap RevakoOstap Revako

                                    352413




                                    352413






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49812508%2fandroid-java-lang-illegalargumentexception-invalid-transition-types%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        404 Error Contact Form 7 ajax form submitting

                                        How to know if a Active Directory user can login interactively

                                        TypeError: fit_transform() missing 1 required positional argument: 'X'