I had this problem for a while and was able to solve it myself.
If in opening your project in Android Studio and something similar to this error message pops up:
A gradle sync did the trick for me.
Just press the button from the toolbar named "sync project with gradle files". The icon is an elephant with a little blue arrow.
If it still does not work, try deleting the .idea folder first, before syncing the gradle files again.