ripple drawable crashes the app on Android API 19

The RippleDrawable was added in API 21, so it's not available on earlier SDKs.

You can move your drawable file to res/drawable-v21 to ensure it doesn't crash on earlier releases.


I had the same problem.

Mina Samy's answer solved my problem also.

Atef Hares asked for an alternative in older versions. What works for me is to use a selector instead of ripple

for example:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <solid android:color="#ccffffff" />
        </shape>
    </item>
    <item android:state_focused="true">
        <shape android:shape="rectangle">
            <stroke android:color="@android:color/white" />
        </shape>
    </item>
    <item android:drawable="@color/playColor" />
</selector>

where

<color name="playColor">#E8EAF6</color>