Skip to content Skip to sidebar Skip to footer

Error : Should Use Android:showasaction When Not Using Support Library

I'm using app compact support library v7 for providing support of lollipop in my app. I was able to make it work perfectly. When my actionbar not showing menu items as icon. I hav

Solution 1:

Update your Menu Bar with this code

<menu xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:android="http://schemas.android.com/apk/res/android" ><item
android:id="@+id/contact_add"android:icon="@drawable/ic_btn_add_contact"android:title="@string/add"app:showAsAction="always"/><item
android:id="@+id/contact_delete"android:icon="@drawable/ic_btn_add_contact"app:showAsAction="never"android:title="@string/delete"/></menu>

You are getting the error because you are using

android:showAsAction="never"

You are supposed to write it as

app:showAsAction="never"

Solution 2:

I solved this in following manner :

Go to Build Path/Configure Build Path and on the Order and Export tab,

check the support jars and uncheck Android Dependencies. 

Do this for support library android-support-v7-appcompat also. Then just clean your project and error is solved.

Here is the link from where I get this.

Post a Comment for "Error : Should Use Android:showasaction When Not Using Support Library"