Cannot find R.layout.activity_main
Check if you not imported android.R accidentally.
I had the same problem, fixed by replacing R
with com.example.appname.R
obviously put your package reference in there instead. Or just add this line to your file:
import com.your.package.R
Or even better, try removing this line from your code if exists:
import android.support.compat.R