1

Why I am getting cannot resolve symbol 'R'..??. When I'm creating new activity on that.Class file I'm getting this problem why I don't know after creation of class I did nothing. (in that R.layout.dashboard). ("R in red color").

public class DashboardActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dashboard);
     }
 }

please help me.

KishuDroid
  • 5,411
  • 4
  • 30
  • 47
chandra
  • 229
  • 1
  • 2
  • 8
  • please go to file and select invalid caches and restart it will restart your android studio and problem will be solved – Milind Vyas Jun 17 '16 at 05:47
  • if problem is not solved yet, this means there must be some naming error at your xml file or you have import some image file which is not in appropriate name format – Ankush Bist Jun 17 '16 at 05:55

2 Answers2

4

I had the same issue before, can solve it by doing

Tools -> Android -> Sync Project with Gradle Files

Some times you need to restart android studio and reset the cache.

File -> Invalidate Caches / Restart
Vamsi Abbineni
  • 479
  • 3
  • 7
  • 23
0

You can also do:

Build -> Clean Project

and then

Build -> Rebuild Project

This does not require you to restart your Android Studio.

Kabir Lal
  • 36
  • 2