lonesarah
lonesarah

Reputation: 3331

java missing required source folder: 'gen'

I just reformatted my computer. I have windows xp sp3 32 bit. I install java jdk android sdk eclipse ide

When I go to make a new android project i get this error.

Project 'HelloAndroid2' is missing required source folder: 'gen'

Please help i'm new to eclipse so give detail responses.

Upvotes: 42

Views: 52767

Answers (15)

Marcos Vasconcelos
Marcos Vasconcelos

Reputation: 18276

In my case, the solution was downgrading the target from android-22 to android-19 at project.properties

Upvotes: 0

Gal Rom
Gal Rom

Reputation: 6461

ok , here's what worked for me:

delete the project and make sure you are not deleting it from the disk!

import it again and it will solve the problem.

Good luck....

Upvotes: 1

Sahar Millis
Sahar Millis

Reputation: 897

Right click on the project> Properties> Android > use the latest API takes care of everything!

Upvotes: 0

Rinkesh
Rinkesh

Reputation: 3316

if gen folder or R.java file is not generated then first check error in XML file and make sure android menifest.xml is present.

Upvotes: 0

Golan Hershku
Golan Hershku

Reputation: 1

My solution was to install android sdk build tools with Android SDK Manager. The probkem was that whenever I clean the project, the gen directory becomes empty.

Hope it will help!

Upvotes: 0

John
John

Reputation: 1

This error occurred when I tried to graphically add a grid layout. Deleting the grid layout folder fixed the problem for me.

Upvotes: 0

Mohammed mansoor
Mohammed mansoor

Reputation: 819

try this... Right click on the project in eclips Android tools -> Fix project properties its works for me

Upvotes: 3

whyoz
whyoz

Reputation: 5246

I tried all these things and none of them worked. One day all my projects are running, next day all my projects have an empty gen folder?

After a series of tests to resolve the phantom missing R.java, the one that led me to a drastic action is when I looked at the Properties > Android and the Project Build Target was greyed out and the project wasn't linked to any SDK, almost as if there were no SDKs installed. This was after I uninstalled 4.2 and reinstalled all tools and SDKs...

Long story short, after trying everything I could find online, I just deleted the whole "adt-bundle-mac-x86_64" folder in my workspace folder, unzipped the original download, and dragged the original folder back into the workspace.

This works as a last resort, however you will have to import all of your projects back into the package explorer by New > Project... > Android Project from Existing Code, and make sure you have the "Copy projects into workspace" UNCHECKED.

IMPORTANT: You will find that you can't do this if your "MainActivity" file is always named "MainActivity," so just for future project creating, it's good practice to always name your main activity something different each time.

Upvotes: 0

HIRECHE ABDELHAMID
HIRECHE ABDELHAMID

Reputation: 1

  1. Go to project
  2. Right Click
  3. New Folder (Res)

In my case it works Fine

Upvotes: 0

Joel
Joel

Reputation: 8948

I just got this problem when I was trying to import a project that was originally created with a version of the SDK that is no longer installed on my machine.

Right click the project. Select Properties. Go to Android. Select a Project Build Target. Click Ok. You might have to clean and rebuild the project as well.

Upvotes: 97

neeraj t
neeraj t

Reputation: 4754

delete the gen and its content and clean the project again.

Upvotes: 0

manicaesar
manicaesar

Reputation: 5054

My case was: I imported Zhou Weikan's cocos2d-android and the error emerged. The most straight-forward solution that came to my mind was to create the folder (right-click on the project in Package Explorer -> New -> Folder and then create new folder named 'gen'. It worked in my case.

Upvotes: 0

Vasu
Vasu

Reputation: 4982

Delete the "gen" folder. Then clean the project. Then build the project again. In my case it worked.

Upvotes: 4

Right-click on the "gen" folder in Eclipse and select Properties. Then, remove the "Derived" checkbox. Then clean the project.

Upvotes: 10

CommonsWare
CommonsWare

Reputation: 1006644

Most likely, there is a problem with one of your resources, preventing R.java from being generated in the gen/ folder. You should have error messages in your Console related to this problem.

Upvotes: 7

Related Questions