Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the import android could not be resolved

Tags:

android

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?

like image 498
user802023 Avatar asked Feb 28 '12 18:02

user802023


People also ask

How to import r File in Android Studio?

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.


2 Answers

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.

like image 70
Deva Avatar answered Oct 04 '22 06:10

Deva


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:

    1. Right Click on your project > properties
    2. Click on the Libraries tab
    3. Click on the JRE
    4. Click remove, then OK
    5. Repeat 1-3 again, but add the JRE again
like image 9
MacGyver Avatar answered Oct 04 '22 06:10

MacGyver