0

I've created an Android Application project and am getting the error "R cannot be resolved to a variable." I've checked my directory, and R.java is present, all the xml files don't seem to have errors, their names don't have capital letters, spaces, or special characters, deleted the "import java.R" line, cleaned, and rebuilt the project, but I've still been getting this error. According to SDK manager, my Android SDK Tools are all up to date. Is there something I've missed?

Yojimbo
  • 23,288
  • 5
  • 44
  • 48
  • android.R could have been imported in in your app's imports. If it is then remove it – Husnain Iqbal Jul 22 '13 at 02:48
  • Wasn't sure if I made this clear, but I've already removed those imports. Was there anything else I might've forgotten to do? – user2605351 Jul 22 '13 at 02:51
  • check this answer: http://stackoverflow.com/questions/16608524/eclipse-giving-error-missing-r-java-file-after-recent-update?lq=1 – Saikat Jul 22 '13 at 02:52
  • again check it and clean the project in project>>Clean – Husnain Iqbal Jul 22 '13 at 02:53
  • Android SDK Build Tools was already installed. android.R isn't imported and I just cleaned it again, but I'm still getting the error. Do I have to do anything else before cleaning and building it? – user2605351 Jul 22 '13 at 03:04

1 Answers1

0

fix all your errors first then clean and run.check your API right click project> properties > android >check API 17

Giant
  • 1,619
  • 7
  • 33
  • 67
  • Are you talking about errors in my xml files or errors in my project? Because the only errors I have in my project right now are all related to R.java, and I can't run with them still in there. Should I just comment the lines out? And my current API is 17. – user2605351 Jul 22 '13 at 03:08
  • can you provide a printscreen or a copy of you problems?i just want to see them – Giant Jul 22 '13 at 03:11
  • The main and only error I'm getting is "R cannot be resolved to a variable". Is there a way for me to put pictures onto stackoverflow? – user2605351 Jul 22 '13 at 03:18
  • use pastebin.com for now – Giant Jul 22 '13 at 03:20
  • Here's my source code http://pastebin.com/HhGhKrbs. Is there anything else you'd like to see? – user2605351 Jul 22 '13 at 03:47
  • wait im having lunch can you check all your drawables are they on the correct folder?i'll be back on you after i eat and you post your xml as well because i don't see anything wrong with your code.. – Giant Jul 22 '13 at 03:57
  • http://pastebin.com/1fS9nXiT Here's my activity_manifest.xml and FileExplorer manifest. What should I be looking for with my drawables? – user2605351 Jul 22 '13 at 04:24
  • i was able to run your program even if im missing a row layout. i put a comment on this line ArrayAdapter fileList = new ArrayAdapter(this, R.layout.row, item); setListAdapter(fileList); and i was able to run it maybe your missing something very important. – Giant Jul 22 '13 at 05:14
  • Sorry, I'm still unfamiliar with using Eclipse in regards to Android app development, where can I find my logcat? – user2605351 Jul 22 '13 at 05:26
  • Nevermind, I found it. My logcat is completely blank. Should there be something there? – user2605351 Jul 22 '13 at 05:28
  • you fixed it?you'll find something there if anything is wrong with your project you can see it in the line caused by line.. – Giant Jul 22 '13 at 05:31
  • I actually haven't done anything yet, and my project's still not running. There may be something wrong with Eclipse, so I think I'll reinstall it and see if I'm still having issues. Thanks for your help! – user2605351 Jul 22 '13 at 05:39