I have a problem using srcCompat in the following code
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:background="@android:color/white"
app:srcCompat="@drawable/ic_shopping_cart_black_24dp" />
the code with problems is
app: srcCompat="@ drawable / ic_shopping_cart_black_24dp"
The error I have is:
To use VectorDrawableCompat, you need to set 'android.defaultConfig.vectorDrawables.useSupportLibrary = true'.
The beginning of the xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
I also have it activated in the build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
vectorDrawables.useSupportLibrary = true