Note: for some reason this post still gets a lot of hits. My post much later might be more helpful.
Trying to figure out how best to import Android projects into eclipse, particularly from a version control checkout. I’ve had the same trouble with trying to use samples downloaded from book/tutorial sites. What I’m trying to do:
- I want to locate the project in my eclipse workspace.
- I don’t want eclipse-specific files in version control – those seem to cause problems when moving between different eclipse installations. Or, in the case of downloaded examples, these files aren’t provided.
- Use git; other VCSs have Eclipse plugins to simplify this – git does too, but it seemed half-baked and I shouldn’t have to use a plugin to do this.
Problems:
- If I check out the project outside my workspace, and then try to create a project in eclipse using that as source, eclipse does not move or copy it into the workspace; it uses the original location (which makes sense)
- If I check out the project within my workspace, and then try to create a project using it as source, eclipse refuses because of the location.
- If I use File -> Import -> General -> Existing projects into workspace, eclipse expects to see its project descriptors (that I deliberately excluded with .gitignore) and refuses the import.
- No other options seem appropriate to doing this
Here’s one way to do it:
- Check out the project somewhere.
- Use the “create project” dialog to create an Android project using this location as source. This adds the requisite eclipse project descriptor files.
- Close the project and delete it (leaving the files in place of course).
- Move the project directory into the eclipse workspace.
- Use File -> Import -> General -> Existing projects to import the project directory – since the project files are there now, this works fine.
I wonder if I’m just nutty leaving the eclipse project files out of the checked-in version. But they just don’t seem to belong there, neh?
