I get this nullPointerException on runtime:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method \'void android.app.ActionB
This is clearly not the problem of OP, but other people may find it useful: for me the solution was to call setContentView(R.layout.activity_main) before the configuration of actionbar.