Search code examples
androidxmlbuildbuildpath

Android Exclude XML File from Build Path in Eclipse


Seems simple, but not. I know how to exclude JAVA files from the build (discussed here), but there's a problem when attempting the same thing with XML files.

Try it yourself: Right-click on the XML file in question, select "Build Path," and lo, the "Exclude" option is replaced with "Add to Build Path." It seems that Eclipse doesn't keep track of anything other than .java files. So these files cannot be excluded because they are technically not in the path yet.

However, if you're just testing some ideas and have a layout file with a bunch of errors (like from a sample file you downloaded from the net), you can't compile your project.


Solution

  • I think you can create a new folder, for example "Trash" and move all the xml giving error to that folder. Make sure to remove the "Trash" folder from the build path. This way you can easily swap in and swap out your xmls as and when needed.