When this type of error arises, then a lot of errors will be shown in your android mainactivity.java file. Infact it will be read. It will generate a lot of errors of cannot be resolved type.
Follow the below steps to solve the problem :
1. Go to Project from Menu Bar and Click on Clean.
Project >>>> Clean.
If it doesn’t solve’s your problem then ….
2. Go to Project from Menu Bar.. simply follow the path below :
Project >>>> Properties >>>>> Select Android >>>>> Choose Android Version.
Hopefully it works out for you.
If it works out for you, then share the post.