Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly clone an Android project using Eclipse and Mercurial

I'm trying to clone an Android project using Eclipse, the Android SDK, and the Mercurial plug-in. I can successfully clone it by doing this: File -> New -> Project -> Clone Existing Mercurial Repository

But the problems start when Eclipse does not seem to recognize that it is an Android project. I can then right-click on the project and: Android Tools -> Convert to Android Project but I don't get to select any build preferences and the source folder icon doesn't get identified as a package. I try to add a new package but Eclipse says the folder is not a Java source folder.

I feel like there is either something wrong with the repository, the way I am cloning it, or that Eclipse/Mercurial/Android SDK don't work well together.

Obviously, I'm a complete greenhorn at this and any help/patience is appreciated. Links to useful tutorials are welcome since none that I've found deal with this particular set of tools.

like image 877
Paul Avatar asked Feb 22 '11 00:02

Paul


2 Answers

Here's what I do:

  1. Use command line to clone the repository in a separate folder outside of the Eclipse workspace folder hierarchy.

    hg clone https://existing/repository/path

  2. In Eclipse, create a new Android project using the "Create project from existing source" option selecting the cloned folder.

Select "Create project from existing source"

The new project is now both an Android project with the Mercurial Team options.

like image 73
Josh Metcalfe Avatar answered Sep 29 '22 12:09

Josh Metcalfe


Cloning an Android Project in Eclipse

    Assume you have a WorkSpace at "D:\workspace" and want to clone an existing Android project named "B".
  1. Windows: go to the WorkSpace
  2. Windows: make a copy of the complete project directory named "B" (Windows makes a "B - Copy")
  3. Windows: rename the copied directory "B - copy" into the clones name, in this case: "B_00"
  4. Windows: Go into directory "B_00" and edit file ".project".
    Change the line with "<name>B</name>" into "<name>B_00</name>"
    Windows: save the file
  5. Start Eclipse and open it in your WorkSpace. "B_00" is not visible.
  6. Eclipse: Menu File -> Import
    Eclipse Import dialog Select: select General -> Existing Projects into Workspace
    Eclipse Import dialog Select: push button "Next"
    Eclipse Import dialog Import Projects: select "select root directory" and then "Browse..." to "B_00"
    Eclipse Import dialog Import Projects: push button Finish.
  7. Eclipse: package explorer: select "B_00"
    Eclipse: Menu Project -> Clean...
  8. Done.
like image 43
zekitez Avatar answered Sep 29 '22 14:09

zekitez