I'm starting to learn Android in Eclipse. But every time I try to create a project the gen folder is empty. So I don't get the R file(or whatever else is in that folder, if anything). Clean does NOT work. There was never an R to begin with. Do I need to download something to make it generate it?
-
R is generate automatically, you do need create nothing there. – goodm Feb 15 '12 at 19:31
-
No. You can do build the project. Then `R` will be generated. – Feb 15 '12 at 19:40
-
If building the project again won't work, please post the error which is getting displayed in red in Console. – 0xC0DED00D Feb 15 '12 at 19:43
-
2I managed to get it fixed(R was not resolved to a var) by unchecking Build Automatically and rechecking again. Thanks – pinksharpii Feb 15 '12 at 20:45
-
@KaylaJohnson you should post your solution as an answer and mark it as correct. – Mar 06 '12 at 03:48
-
I found the solution [here][1] [http://stackoverflow.com/questions/4085959/no-generated-r-java-file-in-my-project][2] [1]: http://stackoverflow.com/questions/4085959/no-generated-r-java-file-in-my-project [2]: http://stackoverflow.com/questions/4085959/no-generated-r-java-file-in-my-project – ThE uSeFuL Jun 07 '13 at 00:00
10 Answers
had the same problem. Check in the Android sdk manager, tools and check if you have installed android sdk build-tools. had the same problem because i hadn't installed it.

- 301
- 3
- 10
None of the solutions posted here worked for me: Clean, changing options, build errors, etc. The problem was caused by importing the Android project as a normal project, i.e. using:
Import > General > Existing Projects Into Workspace
instead of using
Import > Android > Existing Android Code Into Workspace

- 27,566
- 12
- 60
- 72
I had this problem because I had two projects in the same folder and one was the library of the other. Then Eclipse built the projects in the wrong order. What I did to fix this was close the non-library project and then open it again (after the built of the library project), which made it work.

- 6,417
- 5
- 39
- 43
One of those
- Getting rid of 'import android.R' line.
- Cleaning the project and then building it again.
- Closing project and then opening it again.
may help.

- 2,527
- 1
- 19
- 27
May be your problem was related to incorrect target build settings.For example if you use an element in your layout that is available in greater Android targets.You can see more details here.

- 1
- 1

- 13,858
- 11
- 76
- 167
STRUGGLING FROM THIS BUG FROM LAST TWO DAYS. FINALLY SOLVED IT :)
The best way to get rid of this is to go to WINDOWS option on the tool bar -> ANDROID SDK MANAGER -> and tick TOOLS option on the top tools bar (i.e. all all android sdk tools , android sdk platform tools , android sdk build-tools.) and install.
After updating all these too latest versions , go to HELP and hit CHECK FOR UPDATES and install all these new version plugins.
Last step is to go to PROJECT option in the tool bar and uncheck the BUILT AUTOMATICALLY option and go to CLEAN and perform clean on required or on all projects.
I know this method might consume some of your net mb's but will definitely solve your problem.
E.njoy...:)
I ran into the same problem. I had incorrectly set the path of the Android SDK. Setting the path in Windows -> Preferences -> Android did the trick for me.

- 3,952
- 3
- 20
- 21
I had the same problem. Just add these two line in your project.properties file
target=android-19
android.library.reference.1=../appcompat_v7

- 10,505
- 1
- 82
- 81
I happened to have the same problem, solved by "Right click on your project and then click Build Project".

- 3,517
- 3
- 32
- 33
-
The problem is that there is no available option for "Build Project" in some versions. I tried following your solution but it's not here available. I'm using Eclipse Juno. What Version of Eclipse did you used for that image sample you have shown? – David Dimalanta Jul 17 '13 at 06:02
-
Cullen unchecked 'Projects -> Build Automatically', so "Build project" is seen. Or else 'Build Automatically' is enabled, then the 'Build Projects' would not be seen on the menu. It is not a Eclipse version problem. This method only works for some simple occasions. – qiuping345 Sep 06 '13 at 01:49
Try this,
Right click your project
Select properties.
Select Java Build Path
Click add Folder
Select the gen folder
Click OK.

- 941
- 9
- 22