pinksharpii
pinksharpii

Reputation: 527

Gen folder is empty for Android project

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?

Upvotes: 10

Views: 10575

Answers (10)

Pir Fahim Shah
Pir Fahim Shah

Reputation: 10623

I had the same problem. Just add these two line in your project.properties file

 target=android-19
 android.library.reference.1=../appcompat_v7

Upvotes: 0

Kechit Goyal
Kechit Goyal

Reputation: 4252

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.

Upvotes: 0

Subodh Garg
Subodh Garg

Reputation: 1

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...:)

Upvotes: 0

Nick
Nick

Reputation: 28006

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

Upvotes: 2

iglen_
iglen_

Reputation: 311

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.

Upvotes: 7

AndroidEnthusiastic
AndroidEnthusiastic

Reputation: 931

Try this,

Right click your project

Select properties.

Select Java Build Path

Click add Folder

Select the gen folder

Click OK.

Upvotes: -1

Cullen SUN
Cullen SUN

Reputation: 3547

I happened to have the same problem, solved by "Right click on your project and then click Build Project".

Upvotes: -1

hasanghaforian
hasanghaforian

Reputation: 14022

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.

Upvotes: 0

Alê Oliveira
Alê Oliveira

Reputation: 6439

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.

Upvotes: 2

Quarra
Quarra

Reputation: 2695

One of those

  1. Getting rid of 'import android.R' line.
  2. Cleaning the project and then building it again.
  3. Closing project and then opening it again.

may help.

Upvotes: 1

Related Questions