Android - copy existing project with a new name in Eclipse

I'm using Eclipse. Say I have a project 'ProjectA' in the eclipseworkspace (in a folder ProjectA). I want to copy the project but with a new name (ProjectB) and have all the references in the new project adjusted. I can't find much help for what I thought would be a vary basic operation. I want to try out variations on the original design/code and creating a copy seemed the obvious way to go about it.

Any suggestions please.


Solution 1:

  1. Copy your project to a new one (Ctrl+c & Ctrl+v).

  2. Change the package-name in your manifest

  3. Rename your main package with refactor. Don't forget to select.

  4. Change your application name in manifest

    application android:icon="@drawable/icon" android:label="**new name**"
    

Solution 2:

I just want to add an item to Mur Votema's list:

5) Don't forget to open the project you want to copy!

It just cost me some minutes to find out that it doesn't work with closed projects. :-)

Solution 3:

If you are using Eclipse and all you want to do is clone your Android project and give it a new project name, simply do the a copy/paste (Ctrl-C & Ctrl-V - step 1 in Mur's answer above). Eclipse will ask you for a new project name when you paste and you're done. The Eclipse project name and directory are independent of the application name and package.

Solution 4:

Mandatory tasks:

  1. In Eclipse, Copy and paste the project. (Give the project a new name)
  2. In Manifest, update the Package name and save. (Update Launch Configuration)
  3. Refactor and rename the Package name. (Update references)

Optional tasks:

  1. In Manifest, change the Application label and icon, so after
    installing the application on your device it won't be confused with the first one.
  2. Refactor and rename the java files name, so they won't be confused with the original project files.
  3. If you have used Encodings such as UTF-8 in your project (in order to handle languages other than English) you might need to edit and save those files so their font would be shown correctly.

Note: If you do the 3rd task before 2nd task, some undesired imports would be added to your java classes. You then will need to remove those imports.