I was trying to add a dependency to my application and I accidentally modified the wrong build.gradle file and now my application no longer builds correctly.
I faced the same problem. This error occured because I unknowingly deleted the appbuild.gradle file ,so I created a new build.gradle file in my app directory and placed all the required code there then synced this file .The project successfully build after this.