Sunday, August 4, 2013

Copy project in Eclipse

The following is an extension of this and is center around Android/Java but gives you an idea...
Here I wanted to create an app based on the second tutorial that comes with OpenCV (see more here). So, I wanted to copy that and start working on it. This is what I did:
  1. Ctrl+C, Ctrl+V on the project that you want to copy (make sure the project is open)
  2. Enter new project name when prompted.
  3. Change the package name on the AndroidManifes.xml to whatever you want it to be. Click save.
  4. On the "Do you want to update your launch configurations?" say "yes".
  5. Right click on the package name, within src folder, and select refactor-rename. Enter new name. If you click in Preview it may show you a warning (package already exists in gen folder...). I ignored it (continue).
  6. Change the name of the application in the AndroidManifest. The real name may actually be in the strings.xml, so change it there too...
  7. Right click on the class name, inside the package, and select refactor-rename. Change main class name. It will update also any reference to it inside the code.
  8. Note: you may get an error on the link to native library. Just click continue and fix it later... Hint: the easiest way to fix errors is clicking on them and picking from the options they give you.
  9. Now if you click Run, select Android Application, should work...

Update 1: I did similar thing now for a C project I was using in ODE. Steps 1 and 2 are the same. Then in properties-Run/Debug settings delete the old launch configuration and enter a new one for the new project.

Update 2: After I copy the ODE project (ctrl+C, ctrl+V, rename the cpp) the whole file is marked with red warnings/errors. It is solved by going to properties --> C/C++ General --> Indexer and then mark Enable project specific settings, Enable indexer, Use active build configuration.


No comments:

Post a Comment