None of these answers worked for me. I am using Android studio 3.4.1.
I was able to build the project but Android studio showing this error when I was going to deploy it to mobile device. It turns out it is "instant runs" fault.
Follow this answer: https://stackoverflow.com/a/42695197/3197467