I am experiencing an annoying problem with an Android project in Eclipse. All my other Android projects are okey (at the moment). Whenever I perform a clean (Menu:Project->Clean...) the project gives an error and I can't compile/run the app. The error is:
Project 'Project Name' is missing required source folder: 'gen'
As soon as I edit some code the problem disappears until I perform a clean again. I can also right-click on the gen-folder and delete it. Eclipse will recreate the gen-folder and the problem disappears until I perform a clean. This is not a showstopper but it is really annoying since I s开发者_运维知识库ometimes have to do a clean before I run the app.
I'm using the following:
OS: Ubuntu 10.04 (Linux CYLON 2.6.32-24-generic) Eclipse: Helios Release (Build id: 20100617-1415) Android dev tools: 0.9.7.v201005071157-36220 (the latest as of today)We have finally tracked the last problem regarding this bug.
The "clean" action used to always delete the "gen" folder which was wrong. This was fixed in ADT 8 or 9, I can't remember.
However, if the "gen" folder is marked as derived it still gets deleted which leads to the error.
When the "New Project Wizard" is run, the gen folder is created normally, without the "derived" flag, so this is fine.
The following scenario however is broken:
- delete manually gen, or
check in the source code in a repository (git/svn/...) and don't put the "gen" folder in there, then do a check out on another computer.
This leads to ADT recreating automatically the "gen" folder during build, this time enabling the "derived" flag, which will trigger the wrong behavior on "clean".
The temporary solution is to:
- right click "gen"
- choose "Properties"
- uncheck "Derived"
as long as the "gen" folder doesn't get deleted you'll be able to clean your project without side effect.
I just checked in a fix to: - never mark the folder as "derived" - during clean, first remove the "derived" flag from "gen" so that it doesn't get deleted in the case of older projects. Patch is visible at: https://review.source.android.com/#change,22410
I had the same problem, and there is how I solve it:
- Disable "Build Automatically"
- Clean the project
- Create the "gen" folder manually by "New -> Folder"
- Re-enable "Build Automatically" as need
It is not a showstopper but it is so painful and annoying if you have several people working on the same project and you cannot check in the IDE settings into source depot, and you have Ant build script and IDE based build system setup for whatever reason.
It is not a showstopper since you can manually do this do that every other time, but this is just (a) workaround(s). It is painful as many of us have to carefully check logcat/console/navigator/project_setting to make sure there is no other "real" problem present each time it occurs.
I suspect the root cause is the timing issue to validate the "gen" existence, the second is the revalidate the "build path error" condition. The "gen" folder, no matter is marked as derived or not, can be recreated; once it exists, the "build path error" condition should be updated. The second suspection is there is a dead lock for these two condition flags somehow.
Hope you can dig into this issue and fix it eveually.
AFAIK, If Everything is Perfect you have know need to touch or delete the gen Folder.
As soon as I edit some code the problem disappears until I perform a clean again.
What are the things you have changed in your code. Mainly about the Resources. It makes the difference upto my knowledge. dont see only the Logcat and Consider the Console window also shows some error in the red color. First clear that errors and then clean and build your project.
Edit:
Check for:
- Is there Android Package is Missing?
- Right Click--> Properties--> Java Build Path--> Order and Suppport Tab--> Check res or src folders are selected?
精彩评论