The problem was much deeper than it seems.
My code was right. All tips on the topic are relevant and correct.
It turned out that external libraries contain old versions of support-v4 that do not support MATERIAL DESIGN(appcompat-v7:21) , but only appcompat-v7:20
This was the reason for the ActionBar() InflateException error-inflating-class.
Updating support-v4 in all external libraries will solve the problem.
My build.gradle in another topic:
Several dex files define Landroid / support / v4 / .
source share