I have solved by,
This is what solved to me:
For version Lollipop
and higher use this:
android:foreground="?android:attr/selectableItemBackground"
for Pre-Lollipop
use this:
android:foreground="?attr/selectableItemBackground"
2 options:
Another possible reason is: Google's maven repository is not set for the build script.
Open your project's main build.gradle add this line:
buildscript { repositories { google() <-- this // Be also sure that google() is before jcenter() } }
Without this, it may not be able to download the Android Studio Gradle plugin 3.0+. It's not distributed in jCenter but in the Google's maven repository.
Run this command in root of project and resync project
rm .idea/libraries/Gradle__com_android_support_*.xml
del .idea\libraries\Gradle__com_android_support_*.xml
I believe this is a communication problem with the IDE and Android Gradle Plugin. In any case, the only way I've reliably found to resolve this is to delete the problematic libs in the .idea/libraries/
folder.
So, for you, since the lint checks aren't recognizing ?attr/selectableItemBackground
Gradle__com_android_support_xxx.xml
filesI've tried other suggested solutions - had the appcompat-v7
dependency in my module build.gradle file & the google()
repository as the first line in the project build.gradle dependencies. Nada.
These solutions also haven't helped...
In my case help adding maven to build.gradle Project in buildscripts.repositories AND allprojects.repositories. It looks like this:
google()
maven { url 'https://maven.google.com' }
jcenter()