168

I'm trying to import and existing Android project into my current Eclipse workspace. I select File->New->Android Project, which brings up the Android project dialog, I then select, "Create project from existing source", Location, Build Target and Finish.

I get the following error: Invalid project description.

Does anybody know how to get past this error?

paul
  • 2,771
  • 2
  • 21
  • 19
  • 3
    I changed the workspace location to a new directory, it seemed to have fixed this problem. –  Feb 22 '11 at 10:33

14 Answers14

208
  1. File → Import → General → Existing Projects into Workspace → Next
  2. Select root directory: /path/to/project
  3. Projects → Select All
  4. Uncheck Copy projects into workspace and Add project to working sets
  5. Finish
James Wald
  • 13,626
  • 5
  • 52
  • 63
  • @JamesWald, when exporting to later import, should I `Select All` the tree of the project to export rather than only the source? I definitely want the `res` folder too. – Vass Mar 21 '12 at 16:01
  • I've never actually tried to export. It seems to import using the working copy as-is. Try to copy the entire project root and then import it. – James Wald Apr 04 '12 at 06:28
  • @James Wald I got it. Thank u. – Alston Feb 21 '13 at 11:11
  • 1
    this isn't work if the project is originally created in NetBeans, gives "Invalid project description." – Akos K Feb 23 '13 at 21:13
  • @akoskm: NetBeans manages projects in a totally different way than Eclipse. In this case you follow: 'File > New > Project... > Android > Android Project from Existing Code' – AVIDeveloper Oct 30 '13 at 22:19
  • I clone a GIT repository to my workspace. Then I try both Import>General>Existing Projects; and Import>Android>Existing Android code. None works. I tried all sensible combinations... – Stan Jan 14 '14 at 13:37
  • It worked the other way around for me. So I check the boxes so it created a separate copy with git configuration in the folder and I deleted old one and everything is working fine. Although I think there has to be a way to remove the configuration from somewhere in eclipse itself – lazyguy Jan 23 '14 at 21:36
  • Can someone please explain why do we have to uncheck `Copy projects into workspace` and `Add project to working sets` ? Thx – Miles M. Jun 24 '14 at 04:03
  • You don't have to uncheck them, however, the behavior you will get if you leave them checked probably won't match your expectations. Feel free to leave them checked if you know what you're doing. `1.` is the critical step, opening the project as a General project, not an Android project. – James Wald Jun 28 '14 at 00:54
  • This worked for an existing Java project in Eclipse 4.5. – AlainD Jan 09 '17 at 11:01
53

Solved: If you want to "Create project from existing source", you need to create a new directory and then put the project directory tree into that new directory. Then point to the new directory when importing.

Community
  • 1
  • 1
paul
  • 2,771
  • 2
  • 21
  • 19
  • 11
    This is quite a messy solution. I recommend the import-> general -> existing project. Having to crate new folders and copy things around seems like unnecessary extra work and confusion. – JStrahl Apr 02 '12 at 19:50
  • I took this approach but ran into one issue, I wanted my workspace to be in the parent folder of what I was importing. If you take this approach, you must name your project the same name as the folder so it can find the source. – seePatCode Jul 07 '12 at 16:08
  • The write, docmented solution is the one of James Wald. All other 'findings' and 'patches' are misleading and ouf of a professional status. – Ginger Opariti Mar 12 '13 at 12:09
46

This error message appears when the source code you try to import is inside an existing workspace.

Put your source code in a directory OUTSIDE any existing workspace and then import

James Bayley
  • 476
  • 5
  • 4
  • 1
    Exactly. Your solution worked for me. Do you know any reason behind this? – AndroidDev Nov 21 '12 at 06:26
  • Thanks James. Finally i known why i can't import my old projects existing in workspace and solved it. – PhatHV Nov 23 '12 at 02:47
  • Wohoo - worked! It's sad that this issue still exists after so long without any handling by the IDE or at least a notice. – Shaihi May 09 '13 at 19:20
  • IMO this should be the accepted answer. I was fighting a lot with this issue just because I always put existing code in my current Eclipse workspace – Jose_GD Sep 24 '13 at 19:39
  • How does this work with SVN/GIT? I checkout my project to some directory and then import it to the workspace, which changes it's path, therefore it is disconnected from my SVN/GIT client. – Stan Jan 14 '14 at 13:38
13

Just delete the ".project" file in your project folder (it's hidden on Linux, use "ls -a" to show), then from Eclipse, choose Create Android Project from existing source

thucnguyen
  • 1,706
  • 15
  • 14
4

I found James Wald's answer the closest to my solution, except instead of "File->Import->General->Existing Projects into Workspace" (which did not work for me at all) I used "File->Import->Android->Existing Android Code Into Workspace". I am using Helios, maybe your version of Eclipse does not have this quirk.

Arthulia
  • 190
  • 13
4

Im not sure this will solve your problem since I dont know where it originats from, but when I import a project i go File -> Import -> Existing projects into workspace. Maybe it will circumvent your problem.

pgsandstrom
  • 14,361
  • 13
  • 70
  • 104
  • Thanks, but there is nothing on the import dialog that points to an Android project. For any other type of project, that would be ok. – paul Feb 09 '10 at 18:45
  • @paul File -> Import -> Existing projects into workspace should work for any project type, including Android projects, as long as it is a valid Eclipse project. – Mark B Feb 09 '10 at 18:53
  • 3
    The above path should be File -> Import -> General -> Existing projects into workspace. I imported there and it worked like a charm. – Kevin Goff Jul 28 '10 at 19:12
  • Thank you, i was looking for this exactly.it dose not requires to move my project to other location. – Sai Mar 23 '14 at 05:27
4

You can also use Make new > General > Project, then import the project to that project directory

Yi Jiang
  • 49,435
  • 16
  • 136
  • 136
Ullash
  • 41
  • 1
4

It seems you cannot have your project root, with the AndroidManifest.xml deeper than one directory level below your workspace root. I struggled for an hour with this before I just gave up and rearranged my repo.

3

I had the problem of getting errors when checking out an Android project from SVN. This is what I did and the whole thing settled down.
1. checkout the project from SVN as we normally do any other project
2. right click and get properties of the project
3. In the java build path->order and export tab select the android API and OK it

this removed all the project issues
so far so good but not sure if this is the 100% correct method

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
thera
  • 31
  • 1
2

This post helped me: http://code.google.com/p/android/issues/detail?id=8431

user836200
  • 655
  • 2
  • 12
  • 20
1

In my Android Project folder .project file was missing. Restoring the .project file,which will be hidden in Unix OS environment resolved the error.

laaptu
  • 2,963
  • 5
  • 30
  • 49
1

Updating @JamesWald's answer, and incorporating other comments. Assuming you want to create a cfesh copy from, say, a backup in your new workspace:

  1. Put the existing project in a directory not inside the destination workspace.
  2. In Eclipse: File->Import->Android->Existing Android Code into Workspace, Next
  3. Select root directory: /path/to/project/from/step/1
  4. Projects->Select All (or not, as the case may be)
  5. Make sure you set the new project name correctly - To change one click on the old project name (left column) and then click on the new project name (right column) and then edit. It will default to the class name of the Default Activity.
  6. Assuming you want a copy in the destination workspace, check "Copy projects into workspace"
  7. uncheck "Add project to working sets"
  8. Finish
Neil Townsend
  • 6,024
  • 5
  • 35
  • 52
1

Same problem happened to me as well and the .project file was not there in the project. I copied a .project file from an existing android project and replace the project name with the name of the project I am trying to import. Then using File -> Import -> Existing projects into workspace I was able to import the project.

Ambegodas
  • 131
  • 1
  • 9
1

What works for me is that: File > Import > Existing Project into Workspace (under General tab), then choose the project root folder. The importing of Existing Android Code into Workspace somehow does not work on Eclipse for me.

Tony Vu
  • 4,251
  • 3
  • 31
  • 38