as the title suggest, I\'m getting that error in at least 3 of the XML layout files, however, I dont see the attritube \"showsAsAction\" in any of those XML files, did I miss so
ANDROID STUDIO
if you are using ANDROID STUDIO...... use this fix
add
xmlns:compat="http://schemas.android.com/tools"
in menu tag instead of
xmlns:compat="http://schemas.android.com/apk/res-auto "
in menu tag.
you must choose an API 14 with version of 4.0 or grater because any version below 4.0 does not contain in its package the showAsAction attribute
I had this problem when I forgot to add appcompat-v7:+ to my project dependencies. You can do it like this in build.gradle:
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
And this is because I had the following in my menu.xml:
xmlns:app="http://schemas.android.com/apk/res-auto"
and
app:showAsAction="never"
When I removed the xmlns:app namespace and just used android:showAsAction="never"
, I didn't need the appcompat-v7 library anymore.
Are you sure you are looking in the right *.xml file? You seem to look for "showAsAction" in layout xmls, but it's parameter for the menu. Look rather into .../menu/your_activity.xml
The problem you are dealing with is connected with using target less than 4.0 and/or API less than 14.
So,
a) change those parameters,
b) change the value of showAsAction from "never" to "ifRoom".
This happens if you have used the resourceidentifier "ShowAsAction" in your XML. This feature is available only from ver11 i guess. If you are trying to run the same on a lower API version this errror is produced. SOLUTION ->> Right click the project > Properties > Android> Build Target > Choose something greater than API 11
The right answer is to use
android:showAsAction="ifRoom"
instead where android is
xmlns:android="http://schemas.android.com/apk/res/android"