为什么我在Android 4.4中遇到此异常(checkRenderContextUnsafe)

时间:2017-11-01 10:39:09

标签: android

我在 Firebase崩溃报告中看到了这个例外。但我不知道为什么会发生这种情况。它发生在 android 4.4。 有没有人知道为什么我得到这个例外?

class PhoneNumberType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('phonenumber',null,array(
                'label'=>'sitebundle.phonenumber',
                'required' => true
            ))
            ->add('description',null,array(
                'label'=>'sitebundle.description',
            ))
        ;
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'LilWorks\StoreBundle\Entity\PhoneNumber'
        ));
    }
    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'lilworks_storebundle_phonenumber';
    }



}


class AddressType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name',null,array(
                'label'=>'sitebundle.address.name',
            ))
            ->add('street',null,array(
                'label'=>'sitebundle.address.street',
            ))
            ->add('complement',null,array(
                'label'=>'sitebundle.address.complement',
            ))
            ->add('zipCode',null,array(
                'label'=>'sitebundle.address.zipcode',
            ))
            ->add('city',null,array(
                'label'=>'sitebundle.address.city',
            ))
            ->add('country', EntityType::class, array(
                'label'=>'sitebundle.address.country',
                'class'    => 'LilWorksStoreBundle:Country' ,
                'choice_label' => function ($obj) { return   $obj->getName() ; },
                'required' => true ,
                'mapped'=> true,
                'expanded' => false ,
                'multiple' => false
            ))
            ;
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'LilWorks\StoreBundle\Entity\Address'
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'lilworks_storebundle_address';
    }


}

2 个答案:

答案 0 :(得分:1)

在将支持库升级到26.1.0之后,我在KitKat上使用了相同的NPE。 我认为原因在于FragmentManager的变化。

    @Override
    @CallSuper
    public void onAnimationEnd(Animation animation) {
        // If we're attached to a window, assume we're in the normal performTraversals
        // drawing path for Animations running. It's not safe to change the layer type
        // during drawing, so post it to the View to run later. If we're not attached
        // or we're running on N and above, post it to the view. If we're not on N and
        // not attached, do it right now since existing platform versions don't run the
        // hwui renderer for detached views off the UI thread making changing layer type
        // safe, but posting may not be.
        // Prior to N posting to a detached view from a non-Looper thread could cause
        // leaks, since the thread-local run queue on a non-Looper thread would never
        // be flushed.
        if (ViewCompat.isAttachedToWindow(mView) || Build.VERSION.SDK_INT >= 24) {
            mView.post(new Runnable() {
                @Override
                public void run() {
                    mView.setLayerType(View.LAYER_TYPE_NONE, null);
                }
            });
        } else {
            mView.setLayerType(View.LAYER_TYPE_NONE, null);
        }
        super.onAnimationEnd(animation);
    }

编辑:更多信息。只有在应用程序中有片段事务的自定义动画时才会发生这种情况。在进行事务和启动活动之后发生此崩溃

答案 1 :(得分:-1)

我建议您使用新的 Multidex 支持库 See this link