Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Crash] Spinner - "Underflow in restore - more restores than saves" #69

Closed
Bhullnatik opened this issue Dec 21, 2015 · 5 comments
Closed

Comments

@Bhullnatik
Copy link

Hi,
I've got a crash using react-native-material-kit 0.2.4, Android 6.0 and React-Native 0.17.+

I use a spinner in my app to display while I fetch data from a remote server, and I immediately get this error:

12-21 05:43:42.116 11713-11713/? E/AndroidRuntime: FATAL EXCEPTION: main
     Process: com.bhullnatik.app, PID: 11713
     java.lang.IllegalStateException: Underflow in restore - more restores than saves
     at android.graphics.Canvas.native_restore(Native Method)
     at android.graphics.Canvas.restore(Canvas.java:540)
     at com.github.xinthink.rnmk.widget.MKSpinner.onDraw(MKSpinner.java:317)
     at android.view.View.draw(View.java:16178)
     at android.view.View.updateDisplayListIfDirty(View.java:15174)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.updateDisplayListIfDirty(View.java:15169)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.draw(View.java:16181)
     at android.view.View.updateDisplayListIfDirty(View.java:15174)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.draw(View.java:16181)
     at android.view.View.updateDisplayListIfDirty(View.java:15174)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.updateDisplayListIfDirty(View.java:15169)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.updateDisplayListIfDirty(View.java:15169)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.updateDisplayListIfDirty(View.java:15169)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.draw(View.java:16181)
     at android.support.v4.view.ViewPager.draw(ViewPager.java:2262)
     at android.view.View.updateDisplayListIfDirty(View.java:15174)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.draw(View.java:16181)
     at android.view.View.updateDisplayListIfDirty(View.java:15174)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.updateDisplayListIfDirty(View.java:15169)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.draw(View.java:16181)
     at android.view.View.updateDisplayListIfDirty(View.java:15174)
     at android.view.View.draw(View.java:15948)
     at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
     at android.view.View.draw(View.java:16181)
     at android.view.View.updateDisplayListIfDirty(View.java:15174)
     at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
     at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
     at android.view.View.updateDisplayListIfDirty(View.java:15134)
     at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
     at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
     at android.view.View.updateDisplayListIfDirty(View.java:15134)
     at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
     at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
     at android.view.View.updateDisplayListIfDirty(View.java:15134)
     at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
     at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
     at android.view.View.update

The problem appears to come from MKSpinner.java#L321. A quick search on Google directed me to traex/RippleEffect#74 (comment) to fix it and it works, but I'm not sure if it's the best solution.

I'm ready to discuss it or dive into documentation if you need.

@xinthink
Copy link
Owner

Hi @Bhullnatik,
Thank you very much for reporting!
And sorry for replying late, I'll check this out ASAP.

@xinthink
Copy link
Owner

Hi @Bhullnatik, can you post the code reproducing the problem here?

I tried my spinner demo on both Genymotion emulator & physical device with Android 6.x, but it's not crashing.

@Bhullnatik
Copy link
Author

Hi @xinthink, thanks for your answer.
I tried the spinner demo on emulator 6.0 and it worked fine.

The architecture in my app is a bit complicated, but basically I have a ViewPagerAndroid with 4 pages who are fetching data from a remote server; they each display a Spinner using

import { mdl } from 'react-native-material-kit';
export default mdl.Spinner.singleColorSpinner().build();

and then importing it in my project.

I tried also to see if the problem was going from the ViewPager and multiple Spinners at the same time and threw a little thing together to test, it worked fine too.

I went back and tried again on my project and I still have this crash. I will try to localize where it is coming from but I don't really have an idea.

@xinthink
Copy link
Owner

I think we can apply the approach described in traex/RippleEffect#74 (comment). Would you please test it on Android 5? So that I can decide which android version should be adapted.

@Bhullnatik
Copy link
Author

I wasn't able to replicate the issue on other Android versions, it crashes only on 6.0 (I don't have any other 6.x version to try on). All the other Android versions work great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants