Crash on Android 4.4.2: XmlPullParserException, VectorDrawable, Switch
See original GitHub issueSince I’ve upgraded react-native from 0.32.0 to 0.35.0, it seems that older versions of Android have issues with Switch. When running on my device (4.4.2), my app crashes when I request the view containing switches. No problem on the Android emulator or iOS.
Here is the fatal exception:
E/VdcInflateDelegate(16532): Exception while inflating <vector>
E/VdcInflateDelegate(16532): org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0
E/VdcInflateDelegate(16532): at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:717)
E/VdcInflateDelegate(16532): at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:654)
E/VdcInflateDelegate(16532): at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:617)
E/VdcInflateDelegate(16532): at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:745)
E/VdcInflateDelegate(16532): at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:365)
E/VdcInflateDelegate(16532): at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
E/VdcInflateDelegate(16532): at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
E/VdcInflateDelegate(16532): at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
E/VdcInflateDelegate(16532): at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
E/VdcInflateDelegate(16532): at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
E/VdcInflateDelegate(16532): at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
E/VdcInflateDelegate(16532): at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:71)
E/VdcInflateDelegate(16532): at android.support.v7.widget.SwitchCompat.<init>(SwitchCompat.java:212)
E/VdcInflateDelegate(16532): at android.support.v7.widget.SwitchCompat.<init>(SwitchCompat.java:189)
E/VdcInflateDelegate(16532): at android.support.v7.widget.SwitchCompat.<init>(SwitchCompat.java:178)
E/VdcInflateDelegate(16532): at com.facebook.react.views.switchview.ReactSwitch.<init>(ReactSwitch.java:26)
E/VdcInflateDelegate(16532): at com.facebook.react.views.switchview.ReactSwitchManager.createViewInstance(ReactSwitchManager.java:101)
E/VdcInflateDelegate(16532): at com.facebook.react.views.switchview.ReactSwitchManager.createViewInstance(ReactSwitchManager.java:31)
E/VdcInflateDelegate(16532): at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:44)
E/VdcInflateDelegate(16532): at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:211)
E/VdcInflateDelegate(16532): at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:148)
E/VdcInflateDelegate(16532): at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:890)
E/VdcInflateDelegate(16532): at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:863)
E/VdcInflateDelegate(16532): at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
E/VdcInflateDelegate(16532): at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
E/VdcInflateDelegate(16532): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:801)
E/VdcInflateDelegate(16532): at android.view.Choreographer.doCallbacks(Choreographer.java:603)
E/VdcInflateDelegate(16532): at android.view.Choreographer.doFrame(Choreographer.java:572)
E/VdcInflateDelegate(16532): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
E/VdcInflateDelegate(16532): at android.os.Handler.handleCallback(Handler.java:733)
E/VdcInflateDelegate(16532): at android.os.Handler.dispatchMessage(Handler.java:95)
E/VdcInflateDelegate(16532): at android.os.Looper.loop(Looper.java:157)
E/VdcInflateDelegate(16532): at android.app.ActivityThread.main(ActivityThread.java:5356)
E/VdcInflateDelegate(16532): at java.lang.reflect.Method.invokeNative(Native Method)
E/VdcInflateDelegate(16532): at java.lang.reflect.Method.invoke(Method.java:515)
E/VdcInflateDelegate(16532): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
E/VdcInflateDelegate(16532): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
E/VdcInflateDelegate(16532): at dalvik.system.NativeStart.main(Native Method)
This stackoverflow question http://stackoverflow.com/q/35622438 has unsatisfying answers messing up with gradle. This answer http://stackoverflow.com/a/35814299 seems good but requires changing react-native’s source code. I haven’t tried it yet.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Error Caused by org.xmlpull.v1.XmlPullParserException
Add a statement to your build.gradle file of app module: android { defaultConfig { vectorDrawables.useSupportLibrary = true } }. Check this.
Read more >App crashing on 4.4 - AppCompat Vector Drawables - B4X
Hi Does anyone know where I start to diagnose these crashes reported by Android 4.4 users java.lang.RuntimeException: Unable to start ...
Read more >Crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >Vector Asset Wizard Generates Drawables That Crash on ...
Actual Output: A vector drawable in res/drawable/ that crashes on API Level 21-23 devices when used in an ImageView (Android 5.0-6.0): FATAL EXCEPTION:...
Read more >355 (OpenVPN Connect Crashes on Android 4.4.2)
When switching between mobile data and wireless networks or when the wireless network is toggled on and off multiple times it appears to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tema87
how did you upgrade gradle to 2.1.2?
just replace
classpath 'com.android.tools.build:gradle:1.3.1'
toclasspath 'com.android.tools.build:gradle:2.1.2
inandroid/build.gradle
?Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.