I'm trying to use the attribute srcCompat in style:
<item name="app:srcCompat">@drawable/ic_work</item>
Android Studio says nothing about it but when compiling I get this error:
error: style attribute 'app:attr/srcCompat' not found. Message{kind=ERROR, text=error: style attribute 'app:attr/srcCompat' not found., sources=[D:...\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2888], original message=, tool name=Optional.of(AAPT)}
Looks like you want to use the attribute within an style. Hence you don't need the app
-prefix:
<item name="srcCompat">@drawable/ic_work</item>
You need to add below code into gradle vectorDrawables.useSupportLibrary = true
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With