I am getting Error:(26) No resource identifier found for attribute 'srcCompat' in package 'learnapp.android.example.com.learnapp'
when I try to run my app.I have just started learning android today.I have added a new activity and dint change anything in any xml files.
This is the exact error:
Documents/MyProjects/LearnApp/app/src/main/res/layout/activity_display_message.xml Error:(26) No resource identifier found for attribute 'srcCompat' in package 'learnapp.android.example.com.learnapp'
Here is my activity_display_message.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" android:fitsSystemWindows="true" tools:context="learnapp.android.example.com.learnapp.DisplayMessageActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.AppBarLayout> <include layout="@layout/content_display_message" /> <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" app:srcCompat="@android:drawable/ic_dialog_email" /> </LinearLayout>
I have already read similar questions and saw that either the line
xmlns:app="http://schemas.android.com/apk/res-auto"
or
app:srcCompat="@android:drawable/ic_dialog_email" />
was wrong in their case which is not in my case.
Incase it matters this activity's parent activity is MainActivity.java
I just changed
xmlns:app="http://schemas.android.com/apk/res-auto"
to
xmlns:app="http://schemas.android.com/apk/lib/my_package_name"
I saw the answer here
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