Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 585
fredley Avatar asked Mar 30 '11 22:03

fredley


People also ask

How do I move a project to another workspace in Eclipse?

In the Eclipse Navigator view (or any Eclipse view that supports Team operations), navigate to the project that you want to move. Right-click the project and click Team > Move in Repository Workspace. In the Select a Folder window, choose a target component to move the project to and click OK.

Can I move Eclipse workspace to another folder?

Close Eclipse. Open the location of the workspace and cut paste the entire directory (which contains the ". metadata" directory into the intended location. Restart Eclipse with newly copied folder as the workspace (parent directory of ".


2 Answers

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.

like image 59
jimothy Avatar answered Nov 16 '22 02:11

jimothy


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.

like image 35
Bryce Thomas Avatar answered Nov 16 '22 04:11

Bryce Thomas