简体   繁体   English

如何将没有.classpath 或.project 文件的android 项目导入Eclipse?

[英]How do you import an android project with no .classpath or .project files into Eclipse?

I cloned an android project from google code using Mercurial but there was no.classpath or.project files so eclipse doesn't even recognize the code as a project.我使用Mercurial从谷歌代码克隆了一个 android 项目,但没有.classpath 或 .project 文件,所以 eclipse 甚至不将代码识别为项目。

Does anyone know if there is there a simple way to import this project into eclipse?有谁知道是否有一种简单的方法可以将此项目导入 eclipse?

(I was thinking that maybe I could edit these files from other projects and copy them over to this project but I don't know enough about the purpose of these files). (我在想也许我可以从其他项目编辑这些文件并将它们复制到这个项目,但我对这些文件的用途知之甚少)。

This is very simple.这很简单。

You have to know that ".classpath" file is totally the same thing with other android projects.您必须知道“.classpath”文件与其他 android 项目完全相同。 and, also ".project" file is the same except project name in it.并且,“.project”文件也相同,除了其中的项目名称。

  1. Copy ".classpath" and ".project" files from other android project and, paste to to your project directory.从其他 android 项目复制“.classpath”和“.project”文件,并粘贴到您的项目目录。

    if you don't have any android project, just create new one.如果您没有任何 android 项目,只需创建一个新项目。 (it's not important package name.) (package 名称并不重要。)

  2. Open ".project" file on the notepad(or any text editor).在记事本(或任何文本编辑器)上打开“.project”文件。

  3. You can find "name" xml tag on the line 3 of the ".project" file.您可以在“.project”文件的第 3 行找到“名称”xml 标签。 Change this to your real project name.将此更改为您的真实项目名称。

Try creating new android project and importing after.尝试创建新的 android 项目并在之后导入。

Create a new android project and copy the java codes and xml layouts.You are going to need manifest file and I'm pretty sure that Google examples also have the manifest.xml file.Copy it to your project.But if you can't find the manifest use an another manifest and modify it to your project(change class path, activity, class name ect.)and if you need any permissons, they are needed to be included too.It should work,Good Luck! Create a new android project and copy the java codes and xml layouts.You are going to need manifest file and I'm pretty sure that Google examples also have the manifest.xml file.Copy it to your project.But if you can't找到清单使用另一个清单并将其修改为您的项目(更改 class 路径、活动、class 名称等。)如果您需要任何许可,也需要包含它们。它应该可以工作,祝你好运!

You can also do the inverse of the other suggestions: Take a.classpath and.project file from an Eclipse-created standard Android project (the default files directly after creation are fine), copy both files into your example directory, and import as an existing Eclipse project.您也可以与其他建议相反:从 Eclipse 创建的标准 Android 项目中获取一个 .classpath 和 .project 文件(创建后直接使用默认文件即可),将这两个文件复制到您的示例目录中,然后导入为现有 Eclipse 项目。

You may need to adjust the project name in the.project file (XML, just open with a text editor, 3rd line).您可能需要在 .project 文件中调整项目名称(XML,只需使用文本编辑器打开,第 3 行)。

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

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