Search code examples
androideclipseresourcesadt

How To Exclude Files in "/res" Folder of an Android Eclipse Project


Is there any way to exclude certain files under the /res folder from being processed by the Android builder?

I have several Android projects, which I build using Eclipse. I uploaded these projects in our version-control system. The problem is, the version-control adds some "project.pj" file to every folder.

Because of these project.pj files, my projects won't build in Eclipse anymore. I get errors because the builder tries to process these files under /res. I know I can exclude these files for the /src and /gen folders, but how do I exclude them for the /res (and /assets) folders?


Solution

  • aapt is the program that processes the files under res/. There's no way to tell it to ignore certain files. So, short answer: you can't. Your VCS is poorly suited to Android projects. Have you heard of git?

    That said, your build system can be extended to move these unwanted files out of the way, run aapt, and then move them right back. As you're using Eclipse, accomplishing this means hacking its Android plugin to add these additional steps. Or perhaps writing your own plugin that performs these steps around a call to the Android plugin -- I've never hacked on Eclipse myself, and wouldn't want to. To have any other build system (e.g. using maven, or ant, or make, or scripts) do this is as simple as understanding how that system does anything. Eclipse is just way more involved. As a final option, you can write your own scripts in the project directory that move these .pj files around, and run these scripts yourself at appropriate times, without getting any help from Eclipse.