-2

I'm making an app that uploads text to Firebase Firestore, it works fine except when I add a new activity. Then it gives the error "Cannot resolve symbol 'R'" on all R.id.* calls.

I've tried many strategies such as Build->Clean Project and Build->Rebuild Project but I have not found any answers on the internet to fix this.

final Button openUploadApp = (Button) findViewById(R.id.button3);
//This is one affected line and all the other lines are just like this one.

It should go and assign button3 to openUploadApp but it just gives the error stated. Thanks for your help, Mine215

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • I'm not sure if this helps but do check your layout (xml) files for any sort of error. Sometimes, when the layout file is incorrect it will lead to the same error. – Bilal Naeem Mar 30 '19 at 18:06

1 Answers1

1

File > Invalidate Caches > Invalidate and Restart. This is a common Android Studio bug. That should fix it.

bensadiku
  • 436
  • 3
  • 15
  • I've tried that but thanks for the suggestion. Do you think updating Android Studio would help, I don't want to update unless I know it will help? – Reza Bagheri Mar 30 '19 at 20:01