I opened a project that I had not opened in a while in Eclipse today. I was unable to compile due to some (inexplicable) errors.
import android.app.Activity;
import android.os.Bundle;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.view.animation.Animation;
import android.content.Intent;
produces the following error:
the import android could not be resolved
What can I do to resolve this problem?
When you first create a new activity or new class, The R is red and Android Studio says it can't recognize the symbol R. So you may hover over the R symbol, press Alt + Enter to import missing appropriate files.
First try clean / build your project.
If the problem persists. Right click on the project -> go to properties -> go to android -> select the android version and that should work.
Hope it helps.
Try one of these:
‘Clean’ Your Eclipse Project: Go to Project > Clean in Eclipse [This seems to work for me]
Refresh your project folder (right click on your project > refresh) Re-build your project
Clean your builds (If using Ant or Maven – clean your builds) Recreate your project in Eclipse
‘Switch’ Workspace – then Switch back (Eg Change to Debug, then switch back to Java)
‘Switch’ Workspace – then Switch back (Eg Change to Debug, then switch back to Java)
Remove and re-add your JRE:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With