None of the above solutions worked for me.
I didn't have a toolbar in my project, but got the same error.
I cleaned up the project, uninstalled the app. Then I ran a gradlew build --refresh-dependencies, and found out there were some onclick events without corresponding code in the xml files.
I removed them, rebuilt the project, and it worked.
The dependencies didn't seem like were updated, but that's another story.