简体   繁体   English

无法将从GIT克隆的Android项目导入到Eclipse工作区中

[英]Can't import an Android project that was cloned from GIT into an eclipse workspace

I want to be able to clone a project into my workspace, and than import it into Eclipse. 我希望能够将项目克隆到我的工作区中,而不是将其导入到Eclipse中。 When I choose "Import"->"Import existing Android code into workspace", I get: 当我选择“导入”->“将现有的Android代码导入工作区”时,我得到:

Invalid project description. 无效的项目描述。 [ProjectName] overlaps the location of another project: [ProjectName] [ProjectName]与另一个项目的位置重叠:[ProjectName]

When I choose "Import"->"Existing projects into workspace" I get nothing to import (because I keep only the "res" folder, "src" folder and AndroidManifest.xml files in the git repo. 当我选择“导入”->“现有项目到工作区”时,我什么也没导入(因为我在git repo中只保留了“ res”文件夹,“ src”文件夹和AndroidManifest.xml文件。

Any solution that involves copying the repo outside the workspace and importing it will not work since I want it to be cloned into my workspace. 任何涉及将回购复制到工作区之外并导入它的解决方案都将无法正常工作,因为我希望将其克隆到我的工作区中。

How can I achieve what I'm trying to do? 我如何才能实现自己的目标?

First make sure you do not have a directory named [ProjectName] in your workspace. 首先,确保您的工作空间中没有名为[ProjectName]的目录。 If so delete it. 如果是这样,将其删除。 After several tries I would not be surprised that the assistant created it and therefore is not letting you import it because it thinks it exists. 经过几次尝试,助手创建了它,因此不会让您导入,因为它认为它已经存在,因此我不会感到惊讶。

Then, git clone the project outside of your workspace. 然后,git在您的工作空间之外克隆该项目。

Finally, go to new->Android project from existing source, select the cloned directory and make sure you tick the box : Copy the files into workspace 最后,从现有来源转到new-> Android项目,选择克隆的目录并确保选中框: 将文件复制到工作区中

That should work. 那应该工作。

UPDATE AFTER COMMENT : 注释后更新:

Ok, I didn't understand the part about the direct to workspace import. 好的,我不了解有关直接导入工作区的部分。

I just tried and had no problem : 我只是尝试了,没有问题:

  1. clone the github project inside the workspace 在工作区中克隆github项目
  2. In Eclipse : Right click in the Package Explorer 在Eclipse中:在Package Explorer中右键单击
  3. Click "Import...", 点击“导入...”,
  4. Under the directory Android choose : "Existing Android code into workspace" 在Android目录下,选择:“将现有Android代码放入工作区”
  5. Browse to your project directory 浏览到您的项目目录
  6. Make sure not to tick the "Copy projects into workspace" 确保不要勾选 “将项目复制到工作区”
  7. Click finish 点击完成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM