美文网首页
记录一个非常难以定位的bug(java.lang.Illegal

记录一个非常难以定位的bug(java.lang.Illegal

作者: Jon_Snow09 | 来源:发表于2018-11-09 10:45 被阅读0次

    java.lang.IllegalArgumentException: Invalid Transition types

    项目的bugly中出现了这个异常,然而下面的报错日志完全不能帮助定位问题,经过一系列曲折的过程之后发现了问题,在这里分享给大家

    这个异常只出现在4.4的手机上,是因为代码中调用了Fragment的如下方法导致的

    /**
     * Sets the Transition that will be used to move Views out of the scene when the
     * fragment is removed, hidden, or detached when not popping the back stack.
     * The exiting Views will be those that are regular Views or ViewGroups that
     * have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
     * {@link android.transition.Visibility} as exiting is governed by changing visibility
     * from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, the views will
     * remain unaffected.
     *
     * @param transition The Transition to use to move Views out of the Scene when the Fragment
     *          is being closed not due to popping the back stack. <code>transition</code>
     *          must be an
     *          {@link android.transition.Transition android.transition.Transition} or
     *          {@link android.support.transition.Transition android.support.transition.Transition}.
     */
    public void setExitTransition(@Nullable Object transition) {
        ensureAnimationInfo().mExitTransition = transition;
    }
    

    这个方法只能在api > 21的手机上调用,如果低于这个api,就会崩溃,所以调用这个方法之前要判断当前手机的api版本

    相关文章

      网友评论

          本文标题:记录一个非常难以定位的bug(java.lang.Illegal

          本文链接:https://www.haomeiwen.com/subject/mdmnxqtx.html