0

I'm writing here today because I have this error since this morning and I could not manage to correct it by myself and after looking through the internet.

The problem here is a problem you all may know if you already had an android project. My R file is generated when I build my project but it does not seem to be recognized by Android studio. I tried things I read on internet like :

  • Clean my project
  • Looked every xml files for error
  • manually delete my R file and clean my project
  • restarting Android Studio
  • restarting my computer

Do you have any tips that could help me that are not on the list above ?

If this may help you : it's after I pasted some xml files from another project that this error showed up Thanks in advance for your time !

Krupal Shah
  • 8,949
  • 11
  • 57
  • 93
  • 1
    Try invalidating cache and restart (in the file menu). Also make sure you don't have any errors in any of the xml files. – codeMagic May 04 '16 at 16:23
  • What ever xml files you have copied from another project may be it causes errors for yoy. Try `File - >Invalidate Caches And Restart` in Studio. – Jay Rathod May 04 '16 at 16:31
  • What ever you do, It's because of Some error in XML, review them correctly, Be alert in copied XML codes from another resources. – Shree Krishna May 04 '16 at 16:31
  • @ExxSoldat check your String.xml file – Hardik Parmar May 04 '16 at 16:38
  • Remove the new XML files. Get a clean build. add the XML files in one at a time until it breaks. You have an error in that file. [I know this is not as easy as it sounds because there are dependencies from one file to another, but that's how you find the "hidden" error.] – Dale Wilson May 04 '16 at 16:50
  • Did you change your package/application name or etc? Also there maybe be some other errors that prevent R file building. – Volodymyr Baydalka May 04 '16 at 16:54
  • 1
    Thanks everyone for your answers, I will try invalidating my cache and if it does not I will try the way of adding xmls one by one. I reviewed all my xml codes a second time and I was not able to see the errors, so I think the best way will be to add them one by one. And my R file build correctly, I just can't access it's data :/ –  May 04 '16 at 17:21

1 Answers1

1

Trying giving a Build>Clean Project in Android Studio. Study the messages in "Gradle Console" and check for any errors.

If there are errors wrt minSDKVersion, change the version in build.gradle and try again.

This worked for me...

If you still have problems, please post code and gradle error messages...

Jagadesh
  • 41
  • 7
  • Welcome to StackOverflow! Vague "this worked for me" posts should be kept to a minimum. For example, cleaning and rebuilding was stated as tried in the question. If you read the comments, then the problem was actually solved to this post which is 5 months old, and there are many duplicates with the same solutions – OneCricketeer Sep 10 '16 at 02:46