You are using Android Studio, as described here by blackfizz : "checking for lint shows that you imported the appcompat library through gradle, and it thinks that you should use ActionBarActivity because of importing your library. That's why you get an error."
I had the exact problem. Android Studio gave me the error βshould use the application: showAsAction with the appcompat library with xmlns: app =β schemas.android.com/apk/res-auto. βIf I changed my XML, as suggested, my menus in the actionBar disappeared into overflow If I ignored the error, I got the expected behavior, but the error still bothered me.
The real culprits were the following lines in the build.gradle file:
dependencies { β¦ compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.android.support:support-v4:22.1.1' }
which imported the appcompat library and caused all the problems. Since I only aimed at Android 4.4 and above, I was able to delete these two lines. The problem is solved!
I spent several hours figuring this out before reading the answer on blackfizz, so I am posting my answer here in the hope of saving other developers a few hours.
When faced with a similar situation, first check your build.gradle to make sure you accidentally import the appcompat library.
source share