将现有的Android项目导入Eclipse

Bil*_*ote 8 eclipse android

将现有Android项目导入Eclipse时,project.properties的更新不正确.此文件存在于源代码管理中:

# 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
Run Code Online (Sandbox Code Playgroud)

导入项目(并执行NOTHING else)后,文件如下所示:

# 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
Run Code Online (Sandbox Code Playgroud)

清单有以下几项:

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="14"/>
Run Code Online (Sandbox Code Playgroud)

这意味着每次有人导入项目时,我们都必须在project-> properties-> android菜单中重置构建目标.我安装了最新的ADT工具,所有SDK都已下载并可用.

我试过的事情:

  1. 在导入之前删除整个项目,包括磁盘上的内容,克隆和删除project.properties文件.结果相同.
  2. 在导入之前删除整个项目,包括磁盘上的内容,克隆和删除.settings文件夹.结果相同.
  3. 删除整个项目,包括磁盘上的内容,克隆和导入只是为了咧嘴笑.结果相同.
  4. 搜索.project文件.没什么兴趣.
  5. 双重检查ant.properties,build.xml和其他所有纯文本可读文件以获取线索.没什么兴趣.
  6. 用Google搜索问题并仔细检查Eclipse和ADT错误网站是否存在已知问题.纳达.
  7. 事实上,在文件系统上验证了文件在克隆后具有正确的设置,并且导入是罪魁祸首.
  8. 删除整个项目,包括磁盘上的内容,克隆,手动编辑project.properties文件到android-14,导入.这导致project.properties文件保持不变,但由于我使用Google API进行映射,这是不可接受的.

我刚刚确认我可以在导入后"修复"项目.从Eclipse中删除项目,但将内容保留在磁盘上.导入项目错误地再次编辑project.properties.导入过程无法识别project.properties中的Google API条目.

这就是我将项目从文件系统导入Eclipse的方式:

在此输入图像描述

思考?

小智 -1

像您正在做的那样导入您的项目 ie

将现有的 Android 代码放入工作区。

现在删除project.properties。清理并构建项目。

方法二:

如果现有项目有 build.xml 文件,则使用此 ant 构建文件导入选项导入项目

新建-->其他-->现有 Ant 文件中的 Java 项目-->

按照进一步的选项,你就完成了

方法3

右键单击您的项目 ---> 项目属性转到 Android 选择适当的 API 级别。清理并构建您的项目......现在已经完成