I just reread your question and saw your problem is the complete opposite (but some pieces of my old answer still apply to your problem), so here is the updated answer:
Update:
You have imported the appcompat library in your gradle file, but you seem to support only devices newer than API Level 11 or 14? If this is the case, the lint check sees that you have imported the appcompat library via gradle and it thinks that you should use the ActionBarActivity
because of your library import. That's why you are getting the error. But as your android:showAsAction
attribute is working, you are using the native Activity
and the native attribute call is correct, even if the lint check says it is wrong. So if you want to remove the lint error, you have to delete the appcompat lib from your gradle file and maybe change your activity theme to the native Holo Light theme, as your current theme might rely on the appcompat theme.
The answer why it isn't working with the app
namespace is in the XML attribute loading for native respectively library code, which is handled in the old answer.
Old Answer
If you are using the ActionBarActivity
from the support library to reach devices lower than API level 11, the main issue here is, that the ActionBarActivity
recreates some of the native Android XML attributes such as android:showAsAction
in its own scope, which you define with:
xmlns:app="http://schemas.android.com/apk/res-auto"
and then access them with the same attribute (here showAsAction
) in the app:
namespace.
So the ActionBarActivity can't see or reach the native android:showAsAction
attribute as it is only looking for it in the app
namespace and not the android
namespace.
If you want to use the native attribute, you have to use the native Activity
with a Holo Theme, which is only supported from API Level 11 and higher.