Android Studio cannot resolve R in imported project?

I'm trying the new Android Studio. I've exported a project from eclipse, using the build gradle option. I've then imported it in Android Studio. The R.java file under gen has a j in a little red circle on it. And in my source files, I get "cannot resolve symbol R" wherever I have a reference to a resource, e.g. "R.layout.account_list" etc.

I have never used Intellij before. Would appreciate any help as there obviously aren't many answer yet about Android Studio. Thanks!


  1. Press F4 into Project Structure, Check SDKs on left
  2. Click Modules ---> Source Tab, check gen and src as sources

PS: The answer over a year old and the menus have changed.


File -> invalidate caches

then

Restart application


None of the answers on the web so far have helped. Build > Make Project did not work for me. For me it was as simple as choosing this other option (on Android Studio 1.3.1):

Build > Make Module 'module name'


In my case I had an Activity file imported from Eclipse that had the line:

import android.R;

So all of my R classes were resolving to the SDK, as soon as I commented out that line everything compiled correctly to my package. I only noticed the issue when I was moving the project from my Mac to my Windows machine.