React Native致命的崩溃

时间:2016-10-29 21:36:44

标签: android crash react-native fatal-error crashlytics-android

我从Fabric的Crashlytics获取以下数据,描述Android API 19上的以下崩溃。

这是在AVD(Nexus 4)上测试的。

    Fatal Exception: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052
                 at android.content.res.Resources.loadDrawable(Resources.java:2101)
                 at android.content.res.Resources.getDrawable(Resources.java:700)
                 at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
                 at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
                 at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
                 at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
                 at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
                 at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
                 at android.support.design.widget.TabLayout$TabView.<init>(TabLayout.java:1362)
                 at android.support.design.widget.TabLayout.createTabView(TabLayout.java:797)
                 at android.support.design.widget.TabLayout.newTab(TabLayout.java:500)
                 at fr.ayoubdev.rnak.components.tab.TabLayoutManager.addView(TabLayoutManager.java:66)
                 at fr.ayoubdev.rnak.components.tab.TabLayoutManager.addView(TabLayoutManager.java:17)
                 at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:384)
                 at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:175)
                 at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
                 at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
                 at com.facebook.react.uimanager.UIViewOperationQueue.access$1500(UIViewOperationQueue.java:44)
                 at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:868)
                 at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
                 at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
                 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:759)
                 at android.view.Choreographer.doCallbacks(Choreographer.java:574)
                 at android.view.Choreographer.doFrame(Choreographer.java:543)
                 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
                 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:5017)
                 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:779)
                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                 at dalvik.system.NativeStart.main(NativeStart.java)
    Caused by org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
                 at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
                 at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
                 at android.content.res.Resources.loadDrawable(Resources.java:2097)
                 at android.content.res.Resources.getDrawable(Resources.java:700)
                 at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
                 at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
                 at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
                 at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
                 at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
                 at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
                 at android.support.design.widget.TabLayout$TabView.<init>(TabLayout.java:1362)
                 at android.support.design.widget.TabLayout.createTabView(TabLayout.java:797)
                 at android.support.design.widget.TabLayout.newTab(TabLayout.java:500)
                 at fr.ayoubdev.rnak.components.tab.TabLayoutManager.addView(TabLayoutManager.java:66)
                 at fr.ayoubdev.rnak.components.tab.TabLayoutManager.addView(TabLayoutManager.java:17)
                 at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:384)
                 at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:175)
                 at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
                 at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
                 at com.facebook.react.uimanager.UIViewOperationQueue.access$1500(UIViewOperationQueue.java:44)
                 at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:868)
                 at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
                 at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
                 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:759)
                 at android.view.Choreographer.doCallbacks(Choreographer.java:574)
                 at android.view.Choreographer.doFrame(Choreographer.java:543)
                 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
                 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:5017)
                 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:779)
                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                 at dalvik.system.NativeStart.main(NativeStart.java)

我无法理解发生了什么。有人可以帮忙吗?

非常感谢, 丹尼尔。

1 个答案:

答案 0 :(得分:2)

查看How to use vector drawables in Android API lower 21?

另一种补救措施可能是:

static
{
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}