Yeahia Md Arif
Yeahia Md Arif

Reputation: 7936

Error: cardElevation and cardUseCompatPadding not found

After updating Android Studio 2.3.3 to 3.0, CardView in XML can't find cardElevation and cardUseCompactPadding. My current Support Library version 26.1.0

Here is xml code :

<android.support.v7.widget.CardView
app:layout_scrollFlags="scroll|enterAlways"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardUseCompatPadding="true"
android:id="@+id/cardS"
app:cardElevation="5dp">
<android.support.v7.widget.SearchView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="20dp"
    android:id="@+id/search_fragment_searchViewQuery"
    app:popupTheme="@style/AppTheme"
    app:iconifiedByDefault="false"
    android:layout_marginRight="20dp" />
</android.support.v7.widget.CardView>

Log Error :

Error:error: attribute 'com.y34h1a.project:cardElevation' not found.
Error:error: attribute 'com.y34h1a.project:cardUseCompatPadding' not found.
Error:attribute 'com.y34h1a.project:cardElevation' not found.
Error:attribute 'com.y34h1a.project:cardUseCompatPadding' not found.

There are other errors :

Error:failed linking file resources.  
Error:java.util.concurrent.ExecutionException: 
java.util.concurrent.ExecutionException: 
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for 
details
Error:java.util.concurrent.ExecutionException: 
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for 
details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs 
for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

Clean and Rebuild project not solving this problem.

Upvotes: 2

Views: 7642

Answers (2)

Mohsen Pakzad
Mohsen Pakzad

Reputation: 251

I just add 'com.android.support:design:28.0.0' to my project dependencies then it's worked!

Upvotes: 2

Varad Mondkar
Varad Mondkar

Reputation: 1561

Even I came across the same issue after updating Android Studio from 2.3.3 to 3.0

I did the following which helped me overcome the problem -

1. Update compileSdkVersion to 26

compileSdkVersion 26


2. Update targetSdkVersion to 26

targetSdkVersion 26


3. Update Cardview Support Library to 26.1.0

implementation 'com.android.support:cardview-v7:26.1.0'

Upvotes: 7

Related Questions