fredley
fredley

Reputation: 33871

Move Android Eclipse project into workspace

Eclipse is really bugging me with this. I have an Android project that is not in the workspace. Since Android projects don't work correctly if you use Eclipse's Import>existing project you have to make a new Android project from a folder on disk. If this folder is in your workspace, it won't work. If it isn't it works, but then the project is located outside of my workspace folder, which is irritating. Does anyone know a way around this?

Upvotes: 11

Views: 8753

Answers (4)

RCM
RCM

Reputation: 1

Also you must delete the current install on your phone or you will get a signature fail from other comps install of the same app. So do the above and uninstall app off your phone before running the app on the new computer.

Upvotes: 0

jimothy
jimothy

Reputation: 510

You can fix this by following this alternative import flow:

  1. Make sure your project folder you want to import is in your workspace folder
  2. In Eclipse, go to File → Import...
  3. Click General → Existing Projects into Workspace
  4. Make sure the "Select root directory" radio button is selected, and browse to your workspace directory.
  5. In the Projects box, check the box next to the project folder you want to import and click Finish.

This will properly import your Android project.

Upvotes: 12

Bryce Thomas
Bryce Thomas

Reputation: 10789

I've experienced this problem too, when, for example, I tried to create a new android project based on existing source (the Notepad Exercise 1 example program that the android developer's documentation provides). I believe the problem you are experiencing with Import not working is that what you are trying to import a "project" that isn't really an Eclipse project at all (e.g. no .project/.classpath - it's just source code with a directory structure that deceptively looks like a project).

Like cisteams has alluded to above, if this is the problem, the procedure around this goes something like this:

  1. Make a new android project choosing "Create project from existing source", making sure that the source directory is indeed outside your workspace (you'll have to live with this for a second). This should a) make the necessary .project/.classpath files in the source directory (which is still outside your workspace for now) and b) make the project show up in your list in Eclipse.
  2. Right click the project in the Package Explorer and choose Delete, making sure that the option to delete files on disk is unchecked when it comes up.
  3. Now import the project like you would any other project (you can do this now because the .project/.classpath files were created in step 1 above). There should be an option when importing for "Copy projects into workspace", so tick that option.

And you should be done. You can go back now and delete the copy of the project that isn't in your workspace to avoid confusion later on.

Upvotes: 4

cistearns
cistearns

Reputation: 2508

What version of Eclipse and ADT are you using?

Currently this approach is working fine for importing projects that are checked out from SVN. It does require that you have a .project and .classpath files (normally they are checked in to revision control).

If you do not have these files (some open source examples don't include them) then you need to use the Android Wizard for creating a new Android project from existing source. The key here is that it is a New not an Import, so yes it doesn't like it if the files are in the workspace. What you can do is create the new project externally using the wizard to create the .project and .classpath files. Once those exist you can use the normal import to bring the files into your workspace (and check those missing files into your source control).

Upvotes: 0

Related Questions