将 Android 项目档案导入 Eclipse 时出现问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3311474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:39:18  来源:igfitidea点击:

Problem importing Android project archives into Eclipse

androideclipseimportarchive

提问by baroquedub

My apologies if this is a stupid newbie question...

如果这是一个愚蠢的新手问题,我很抱歉......

I'm using Eclipse (Helios release) and have the Android SDK all configured as per the developer.android.com recommendations. I can create and run new projects without any problem but I can't import archived project code samples (found on the web etc.) using Import > Existing Projects Into Workspace.

我正在使用 Eclipse(Helios 版本)并按照 developer.android.com 的建议配置了所有的 Android SDK。我可以毫无问题地创建和运行新项目,但我无法使用 Import > Existing Projects Into Workspace 导入存档的项目代码示例(在 Web 等上找到)。

Importing a zip creates a project but it doesn't create it as an Android project and the console displays the error: "Project has no default.properties file! Edit the project properties to set one."

导入 zip 会创建一个项目,但不会将其创建为 Android 项目,并且控制台显示错误:“项目没有 default.properties 文件!编辑项目属性以设置一个。”

I've tried going into the project Properties but as soon as I click on 'Android' in the properties tree a pop-up appears saying "Could Not Accept Changes: The currently displayed page contains invalid values"

我已经尝试进入项目属性,但是一旦我在属性树中单击“Android”,就会出现一个弹出窗口,提示“无法接受更改:当前显示的页面包含无效值”

See: http://screencast.com/t/ZmY3ZWQ4

请参阅:http: //screencast.com/t/ZmY3ZWQ4

But if I do this on one of my own projects I have no such error, and I'm able to change things such as the Android Platform/API level. I'm also able to archive my own projects (using export) and import them again without any problems... nut not other people's archives! Am I being really stupid?

但是,如果我在自己的项目之一上执行此操作,则不会出现此类错误,并且可以更改诸如 Android 平台/API 级别之类的内容。我还可以存档我自己的项目(使用导出)并再次导入它们而不会出现任何问题...坚果不是其他人的存档!我真的很傻吗?

Any help would be really appreciated!

任何帮助将非常感激!

回答by Josh Bleecher Snyder

All the baseline default.properties needs is a line like:

所有基线 default.properties 需要的是一行:

target=android-8

target=android-8

You can most likely copy another projects' default.properties into this project. A (not-so-)quick restart of Eclipse, a rebuilding of the workspace, and you're off to the races.

您很可能可以将另一个项目的 default.properties 复制到该项目中。Eclipse 的(不那么)快速重新启动,工作区的重建,然后您就可以开始比赛了。

It's really lame that this is needed -- it should happen as part of the import process, I would think.

需要这样做真的很糟糕 - 我认为它应该作为导入过程的一部分发生。

回答by Chirag Patel

just change your

只是改变你的

project.properties file to default.properties 

and restart your eclipse

并重新启动你的日食

it's done..

完成..

回答by imran

Right click on the project in navigator window, go to android tools and click on fix project properties. It might work, as it did for me ;-)

右键单击导航器窗口中的项目,转到 android 工具并单击修复项目属性。它可能会起作用,就像对我一样;-)

回答by mutkan

You can look at this section, it works for me: Project has no default.properties file!

你可以看看这个部分,它对我有用项目没有 default.properties 文件!

回答by Sephy

If you want to change the library of your project, do that :
- right click on the project name
- Build Path
- Configure build path
- click Android on the left, and select the library you need.

如果要更改项目的库,请执行以下操作:
- 右键单击​​项目名称
- 构建路径
- 配置构建路径
- 单击左侧的 Android,然后选择您需要的库。

回答by techayu

I had the same problem. What you are trying is little difficult.Just unzip the files ,copy res and src folders to ur existing project.The problem is the files starting with "." which have settings for their android and eclipse. So you need to modify all that,so simply create new project or to ur existing one copy res, src and AndroidManifest.xml file.
It worked for me .

我有同样的问题。您正在尝试的操作有点困难。只需解压缩文件,将 res 和 src 文件夹复制到您现有的项目中。问题是文件以“.”开头。其中有针对他们的 android 和 eclipse 的设置。所以你需要修改所有这些,所以只需创建新项目或你现有的一份 res、src 和 AndroidManifest.xml 文件。
它对我有用。

回答by Enzo

In the project right click Android Tools-> Fix Project Properties

在项目中右键 Android Tools->Fix Project Properties