Clean in Eclipse temporarily destroys an Android project with an error message: the required source folder is missing: 'gen'

I am having an annoying problem with an Android project in Eclipse. All my other Android projects are okey (for now). Whenever I perform a cleanup (menu: Project-> Clean ...), the project gives an error, and I cannot compile / run the application. Error:

Project 'Project Name' missing required source folder: 'gen'

As soon as I edit the code, the problem disappears until I repeat the purity. I can also right-click the gen folder and delete it. Eclipse recreates the gen folder and the problem goes away until I do a clean one. This is not a showstopper, but it is really annoying, as sometimes I have to do a clean one before starting the application.

I am using the following:
OS: Ubuntu 10.04 (Linux CYLON 2.6.32-24-generic)
Eclipse: Helios release (build code: 20100617-1415)
Android dev tools: 0.9.7.v201005071157-36220 (the latest to date)

+4
source share
4 answers

Finally, we traced the last problem associated with this error.

A "clean" action used to always delete the "gen" folder, which was incorrect. This was fixed in 8 or 9 ADT, I do not remember.

However, if the "gen" folder is marked as a derivative, it is still deleted, which leads to an error.

When the "New Project Wizard" starts, the gen folder is created normally, without the "derived" flag, so this is normal.

The following scenario is broken:

  • manually remove gen or
  • check the source code in the repository (git / svn / ...) and donโ€™t put the โ€œgenโ€ folder there, and then check on another computer.

  • This causes ADT to automatically recreate the gen folder during build, this time turning on the derived flag, which will result in incorrect clean behavior.

Temporary solution:

  • right click "gen"
  • select "Properties"
  • uncheck the box Derivatives

until the gen folder is deleted, you can clear your project without a side effect.

I just checked in the fix: - never mark the folder as "derivative" - โ€‹โ€‹during cleaning, first remove the "derivative" flag from "gen" so that it is not deleted in case of old projects. The patch is displayed at: https://review.source.android.com/#change,22410

+3
source

I had the same problem and decided to solve it:

  • Disable Automatically Create
  • Clear project
  • Create the gen folder manually using New โ†’ Folder
  • Re-enable Build Automatically as needed
+2
source

This is not a demonstration, but it is so painful and annoying if you have several people working in the same project and you canโ€™t check the IDE settings in the source repository, and you have Ant build script and build the system using any IDE reason.

This is not a showstopper, as you can manually do it every time, but it is just (a) workarounds. This is very painful, as many of us must carefully check logcat / console / navigator / project_setting to make sure that there is no other โ€œrealโ€ problem.

I suspect that the main reason is the synchronization problem to check for the existence of "gen", the second is to check the status of the error "build path error". The gen folder, whether marked as derivative or not, can be recreated; once it exists, the condition "build path error" should be updated. The second warning is a deadlock for these two condition flags.

I hope that you will be able to delve into this problem and fix it as soon as possible.

+1
source

AFAIK. If everything is perfect, you know you 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 things have you changed in your code. Mostly about resources. It changes my knowledge. I donโ€™t see only Logcat windows and consider the console window also shows some error in red . Clear these errors first, and then clear and create your project.

Edit:

Check:

  • Is the Android package missing?
  • Right-click -> Properties -> Java Build Path -> Order and Suppport tab -> Check if return folders or src are selected?
0
source

All Articles