Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IllegalStateException using Ripple Effect Library on Android M Devices

Using this library to implement Ripple Effect and it works just fine except on Android M devices.

On Android M Devices getting IllegalStateException that says Underflow in restore - more restores than saves

FATAL EXCEPTION: main
Process: com.example.ripplethings, PID: 20119
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.andexert.library.RippleView.draw(RippleView.java:166)
like image 993
Oreo Avatar asked Feb 19 '16 09:02

Oreo


1 Answers

It seems like a bug in the library itself on Android 6.0, Possible ways to avoid the bug is

1) Use the com.balysv:material-ripple:1.0.2 library it seems more stable

2) Or you can use place separate layout for 21+ let the Android M handle the ripple itself. Just use the proper ripple holder for layouts and views

3) Or you can modify the library source code itself as per this suggestion

4)A fixed version of this library is available @ git and you can use it in your gradle like

compile 'com.github.Hitta:RippleEffect:82cf00e551'
repositories {
            ...
            maven { url "https://jitpack.io" }
        }
like image 56
Renjith K N Avatar answered Nov 09 '22 21:11

Renjith K N