XML required API level error although it's not used



I'm trying to add the ripple touch effect on a button background. I have everything set up and it works when both the target and minimum SDK version is set to 21. However, when I set the min SDK version to 14, the XML file gives an error and says it REQUIRES a minimum of SDK version 21.


I understand this, but the problem is that I have an Android version check at runtime, which loads a different activity if the Android version is below Lollipop. Meaning that if the version is below lollipop, that XML is never used, yet it still gives an error and doesn't allow me to run the app.


My "ripple.xml" file looks like this.



<?xml version="1.0" encoding="utf-8"?>
<ripple android:color="#CCCCCC" xmlns:android="http://ift.tt/nIICcg">
<item android:drawable="@drawable/background"></item>
</ripple>

No comments:

Post a Comment