-1

I was working on my project when suddenly the project showed an error in every java file where I used the find view by id method. Then it showed a Red line under "R". import R.java then again an error under layout id and layout name. I have created a new project but it still shows the same error in the main_Activity.java file. Please help me to resolve this problem.

Hans1984
  • 796
  • 11
  • 24
Mubashar
  • 333
  • 6
  • 15

2 Answers2

1

You have not followed naming conventions properly for any view in xml files, layout file name, drawable name or same key in any values file. Whatever error is ... most likely its in res folder not in your code.

Even if it is not showing any error in res folder, it is still there !

Even if you can't solve the error, add your xml files , their names, drawable name, any one could else point out error for you.

Though it is just a small thing , I have seen 99% freshers stuck into it. By name of your class "main_Activity.java", you certainly not in remaining 1% !!

Follow naming conventions ALWAYS !

And here are godzillion answers ... R cannot be resolved - Android error

Community
  • 1
  • 1
Sourab Sharma
  • 2,940
  • 1
  • 25
  • 38
0

You haven't added in code so abstractly try these:

  1. Check AndroidManifest.xml for any errors.
  2. Project - Clean - Clean Project.
  3. Add appcompat_v7 library. This is an Android Support Library.
zackygaurav
  • 4,369
  • 5
  • 26
  • 40