导入现有的Andr​​oid项目到Eclipse中 [英] Importing Existing Android Project into Eclipse

查看:229
本文介绍了导入现有的Andr​​oid项目到Eclipse中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

project.properties被错误地更新。该文件存在于源代码控制:

project.properties is being updated incorrectly when importing an Existing Android project into Eclipse. This file exists in source control:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=Google Inc.:Google APIs:14

导入项目(和什么也不做)之后,文件看起来是这样的:

After importing the project (and doing NOTHING else) the file looks like this:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-8

该清单有以下三个项目:

The manifest has the following items:

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="14"/>

这意味着,每次有人进口我们不得不重新构建目标的项目 - >属性 - > Android的菜单项目。我已经安装了最新的ADT工具和所有的SDK下载和使用。

This means that every time someone imports the project we're having to reset the build target in the project->properties->android menu. I have the latest ADT tools installed and all SDKs are downloaded and available.

东西:

  1. 删除整个项目包括对磁盘内容,克隆和删除project.properties文件导入之前。同样的结果。
  2. 删除整个项目包括对磁盘内容,克隆和删除.settings文件夹导入之前。同样的结果。
  3. 删除整个项目包括对磁盘内容,克隆和导入只是笑着。同样的结果。
  4. 通过项目文件对洗涤。感兴趣的什么也没有。
  5. 双击选中ant.properties,build.xml文件和所有其他的纯文本可读的文件线索。感兴趣的什么也没有。
  6. 在Google搜索的问题和双重检查的Eclipse和ADT错误地点的已知问题。虚无缥缈。
  7. 验证文件呢,其实在文件系统上,有正确的设置克隆后的进口是罪魁祸首。
  8. 删除整个项目包括磁盘,克隆的内容,手动编辑的project.properties文件到Android-14,进口。这导致了一个不变的project.properties文件,但由于我使用的是谷歌的API映射,这是不能接受的。

我只是验证我可以修复这是进口后的项目。删除从Eclipse中的项目,但留下的内容在磁盘上。导入的项目不正确再次编辑project.properties。导入过程无法识别project.properties的谷歌API的条目。

I just verified that I can "fix" the project after it's imported. Delete the project from Eclipse but leaving the contents on disk. Importing the project incorrectly edits project.properties again. The import process does not recognize the Google APIs entries in project.properties.

这是我应得从文件系统项目到Eclipse:

This is how I'm getting the project from the file system into Eclipse:

思考?

推荐答案

对于现在使用的常规 - >现有项目到工作区,而不是Android的 - >现有的Andr​​oid code到工作区,避免project.properties文件是自动不当产生的。

For now use General -> Existing Projects into Workspace instead of the Android -> Existing Android Code into Workspace to avoid the project.properties file being auto generated improperly.

您是正确的,如果你的Andr​​oid项目不具备的.classpath,android的封装结构丢失。但是如果你的Andr​​oid项目已经是一个Eclipse项目,应该引入就好了。

You are correct, if your android project does not have a .classpath, the android package structure is lost. But if your android project is already an Eclipse project it should import just fine.

这是Eclipse的一个错误。 HTTP://$c$c.google.com/p /安卓/问题/详细信息?ID = 40161

This is a bug in eclipse. http://code.google.com/p/android/issues/detail?id=40161

此摘录说明问题。

如果要导入一个Eclipse项目(其中有一个的.classpath),仅仅使用了通用的Eclipse项目导入机制;这仍然存在(导入>常规>现有项目进入工作区),我们增加了导入> Android的>现有的Andr​​oid code进入工作区,因为有很多人有非Eclipse项目导入,这是不能很好的支持,你不得不新建,然后使用复选框以选择现有的code等,以及该项目的位置和现有资源的位置是不明确的。我们作出了现有的Andr​​oid code导入选项的的为Eclipse项目,工​​作等,这将是一个明显的方式拉来源$ C ​​$ C,但是,这是新的code,不是一般的Eclipse内建进口code,这就是为什么它不拿起它采用的方式,项目名称,(在相关的$ C它处理从源代码中添加新项目,$ C在code现在做同样古怪的方式做的行为,从清单中选择一个项目名称)。然而,使它看起来了项目名字从项目文件作为一个更好的默认情况下,如果present,应该是可行的,所以我会尝试添加为好。

"If you are importing an Eclipse project (which has a .classpath), just use the generic Eclipse project import mechanism; that's still there (Import > General > Existing Projects Into Workspace). We added Import > Android > Existing Android Code Into Workspace because a lot of people had non-Eclipse projects to import, which was not well supported; you had to "Create New" and then use a checkbox to select "existing code" etc, and the location of the project and the location of the existing sources was ambiguous. We made the Existing Android Code import option also work for Eclipse projects, such that it would be a single obvious way to pull in source code. But this is new code, not the general Eclipse builtin import code, which is why it doesn't pick up the project name in the way it used to. (The related code which handled adding new project from source did act in the same quirky way the code does now, picking a project name from the manifest). However, making it look up the project name from the .project file as a better default, if present, should be doable so I'll try to add that as well."

这篇关于导入现有的Andr​​oid项目到Eclipse中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆