0

I have no errors in my res/ dir, yet, all my java files cannot find the compiled version of my R.java because it is failing to compile.

What am I overlooking??enter image description here

hunterp
  • 15,716
  • 18
  • 63
  • 115
  • Are you using the same package name in your manifest and source code? – Raghav Sood Jul 06 '12 at 20:12
  • Do you have a gen folder in your project? Are you using Eclipse? Did you create the project as Android project? Do you have errors in the source code? – User Jul 06 '12 at 20:12
  • nothing is in my gen folder. Why? – hunterp Jul 06 '12 at 20:16
  • You must have a list of errors in the `Problems` view (Window -> Show View -> Problems). One or more of those will be unrelated to both `R` and the build path. If there are none, clean the project and all libraries and retry. – Cat Jul 06 '12 at 20:16
  • http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error basically someone at Google didn't figure out that the R library will get mixed up with other stuff. – Serguei Fedorov Jul 06 '12 at 20:18
  • Do you have errors in the source code, or in the build path? That could be the reason compilation files and because of that the files are not generated. – User Jul 06 '12 at 20:19
  • I supressed the translation issues from Android-Lint – hunterp Jul 06 '12 at 20:20
  • Uhm, you don't have a build target. I think you should have at least one, otherwise, what are you building...? – User Jul 06 '12 at 20:21
  • Yeah, I have not touched this project in many months. something must be wrong. – hunterp Jul 06 '12 at 20:21
  • Based on the image you uploaded, you do not have the android sdk installed or you have not set its location in Window->Preferences->Android->SDK location. The Android Project Build Target pane should show the available platforms, it shouldn't be empty – ab11 Jul 06 '12 at 20:21
  • Yeah, I had v18 of the sdk...it needs 20.. someone want to submit answer for easy points? – hunterp Jul 06 '12 at 20:23

1 Answers1

0
  • Do not import any R files. Check your import statements to make sure you aren't including android.R or com.google.maps.R or whatever.whatever.whatever.R.
  • Check if you have any errors, especially with your layout files. Sometimes, Eclipse's error-checker will miss some XML errors and these will trip up your auto-generation.
  • Make sure you have the proper build path selected. Right-click your project in the Package Explorer, go to Properties -> Android -> Project Build Target. Check your desired build target.
  • Make sure everything is up-to-date (Eclipse, the Android SDK, tools, etc.)
  • If all else fails, just restart your Eclipse. If that doesn't work, restart your computer. You'd surprised how often a simple restart will fix your problems.
Jason L
  • 1,812
  • 2
  • 22
  • 43