Hi There,

 

After long time research, finally i got the resolution of this boring error. As you guys know, when you try to clean an android project by eclipse, this error occur sometimes. It's really a boring one since i as a android developer, it made me lost my hair. Anyway, i got the resolution by stackoverflow, thanks for them.

 

 Now i paste the answer here, hope to help any other developer as me.  You guys can transhipping this article, but please leave the original link. Thanks advanced.

 

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 

 

 

Thanks,

 

Henry Hu