26

What is the quickest way to duplicate an existing android project in the workspace, copying that project (with a new name) to the workspace as well?

I already have a method to duplicate an SDK-sample project into workspace, but it involves an intermediate step in which project is "created from existing source" in a temporary folder which isn't the workspace.

Is there a shorter way?

Community
  • 1
  • 1
Android Eve
  • 14,864
  • 26
  • 71
  • 96

4 Answers4

48

If you right click on a project in Project Explorer and choose copy, and then paste it into the project explorer it will give you an option to rename it. You will have to open the project you want to copy so no projects are selected in the Project Explorer.

EDIT: The solution is not to click outside the project but copying an opened project, as @android-eve said.

Dani bISHOP
  • 1,226
  • 11
  • 18
Robby Pond
  • 73,164
  • 16
  • 126
  • 119
  • Your method looks ideal. My only problem is that I don't know how to "click away": In Project Explorer I am able to choose Copy for the desired project, but then no matter where I click (even empty space in Project explorer) that project is still selected. How do I de-select it? – Android Eve Mar 02 '11 at 16:49
  • @blindstuff Ctrl+V doesn't work as long as one of the projects is selected. (also, the 'Paste' item in the context menu is greyed out to indicate that). I am using Eclipse 3.6.1. How do I de-select a project as @Robby Pond advised? – Android Eve Mar 02 '11 at 16:55
  • 7
    OK, I solved the mystery. In order for the 'Paste' option to be available, the 'Copy' operation must be performed on an **open** project. If the project is closed, this method won't work. It's interesting to understand why (I have a feeling this isn't a bug but rather a protective feature), but for now @Robby Pond's method works very well. Thank you! – Android Eve Mar 02 '11 at 17:02
  • opening the project worked for me. before trying to copy a closed project wouldn't allow me to use paste. – gonzobrains Jul 26 '12 at 11:20
3

Here's the procedure I've been using for making a new copy of a project. It's worked fone for a large project I wanted to break down to a smaller more specialized and I also have a scene manager template that I clone from for the start of each new project. All these steps seem to work fine and it's done within Eclipse/ADT

how to clone a project and rename it. ------------------------------ open up the source project, (ie just click on it. name of project and leave it highlighted) then control-c control-v , give it a new name..note this is a TEMP name because you will have to rechange it in a second so "the copy" is just fine.

The copy should paste in place, open up the copy ,right click on top line and select "refactor--> rename--> give the new name you want to name the whole project and check "update references" if it's not already checked.

Then go into manifest and change the name there. Be sure and make the change in the "manifest" tab NOT in the xml code . and hit save icon , a pop-up will ask if you want to "update your Launch Configurations", hit "YES"

Click on "SRC" at the top of the package. Notice how the package name under the src folder has not changed names. right click that and select refactor>, Change the name. ... a rename menu appears, all the boxes should be checked and hit "preview" (you might get a warning it already exists...go on anyway) that should then change the package names in the individual class files. Open a few and check the top line for the package is updated. under res/values is a file strings.xml. Open it you should see this. XXXXXXXX

and change the XXXXXXX part to the new name you want for your icon on the device/emulator, probably the Apps name that's it. It was such a pain to do this each time so I created my own "doc" to help. I've double checked this a few time

1

As blindstuff pointed out, but I missed because it wasn't an answer, Ctrl+C, Ctrl+V works for open projects in Eclipse.

Community
  • 1
  • 1
Graham P Heath
  • 7,009
  • 3
  • 31
  • 45
0

It's very simple, open your project you want to copy, close all other project. Click to choose your project at project explorer, Ctr + C and Ctr + V.