How do you import an android project with no .clas

2019-07-06 00:25发布

问题:

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.

Does anyone know if there is there a simple way to import this project into 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).

回答1:

This is very simple.

You have to know that ".classpath" file is totally the same thing with other android projects. and, also ".project" file is the same except project name in it.

  1. Copy ".classpath" and ".project" files from other android project and, paste to to your project directory.

    if you don't have any android project, just create new one. (it's not important package name.)

  2. Open ".project" file on the notepad(or any text editor).

  3. You can find "name" xml tag on the line 3 of the ".project" file. Change this to your real project name.



回答2:

Try creating new android project and importing after.



回答3:

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!



回答4:

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.

You may need to adjust the project name in the .project file (XML, just open with a text editor, 3rd line).