try downloading the sdk again, (you dont gotta update it) and use a fresh version of eclipse. use your workspace, right click project, export, and choose export as gradle file under android. now in android studio, import project, then navigate to your old workspace and choose the projects main file from there. should work, if not double check your file and be sure it runs in eclipse. (if it is a complicated application i suppose it is also possible you ran into one of the bugs google warns you about.

edit: you choose the main source folder of your project not the build.gradle!


i had a similar problem with my android proyect, my problem began when i installed androidstudio and export my previous android eclipse proyect to get generated gradle file, but i still wanted to keep using eclipse. when i came back to eclipse, it has highlighted my code with the error "r cannot be resolved to a variable". to solve this issue i had to update the tool package, which contains three sub-items as you see in the image below.screeshot from android sdk manager on eclipse

you must be sure that all your tools have been updated.


if you have the latest sdk version then you just need to delete the import android.r; and build the project again.

in reality you just need to delete the import, and androidstudio will auto build, but it won't be automatic. of course, your res.xml still needs to be correct.


when i imported from eclipse, no res-folder was created. the drawable, layout, values and other folders normally reside in res with eclipse. but upon importing, they ended up in src/main/java. so i right-clicked on folder main and made a folder named res in it. then i refactor->move-d the the folders that should be in res from the java folder. then i clicked on the floppydisk saveall icon. then i opened the myproject-myproject.iml-file (right below the src-folder) and deleted the line

<option name="res_folders_relative_path" value="" />

upon saving the edited file, the project wants to reload. after this, i can "make" without errors it seems.


first make sure that your gradle build passes.

gradle build

or with a little bit help in eclipse using gradle for eclipse plugin.


i faced that problem too, do the following things,

  1. do update your adt to r22,
  2. get update of r22 in adt,
  3. close your project from file-close project
  4. exit from studio,
  5. launch studio again,
  6. select your project from recent projects which are displayed in left panel of home

Related Query

More Query from same tag