java - 从 Android Git 创建 Eclipse 项目

标签 java android eclipse git

我已经从 Android git 下载了一个开源 Android 应用程序(音乐应用程序),我正在尝试从源代码创建一个新项目。使用该现有源创建新项目不起作用,给我一个“无效的描述错误”。有帮助吗?

最佳答案

您一定是指错误消息“invalid project description”。

参见 this thread (以下相关摘录,重点是我的):

如果您在下载的应用程序中看到一个 .project,您可以尝试 "File"+ "Import"+ "Existing Projects into Workspace" 并选择音乐样本的目录。

但如果不是,则使用 New> Android Project> Create project from existing source 是 正确的做法。
确保选择您想要的 Android 目标(1.1 或 1.5 或 2.0):
“新项目”向导会自动为您选择正确的示例目录。
然后选择“浏览”和音乐目录。然后它应该填充新 android 项目向导底部的属性。

However you should not put your workspace in %ANDROID_HOME%\samples.
Leave it somewhere else (My Documents, whatever).
I suspect you get a conflict because Eclipse tries to create a project and there's already a directory of the same name.
In either case, can you look at your_workspace_dir/.metadata/.log for a more verbose error and post it?

简而言之:

  • Change the workspace other than android SDK.
  • Then dont put project name first.
  • Browse the project of \samples\Music in create project from the source.
  • The other fields will fill automaticaly.
  • Then execute....

另见 this tutorial (对于蛇样本)

I wanted to open up the Snake sample provided in the SDK samples.
For this, choose ‘Create project from existing source’ in the New Android Project window and select the Snake directory from Samples.
This will set the package name, activity name, and application name for you.

http://www.infinitezest.com/images/eclipse-android-snake-project.jpg


也就是说,如果在导入项目后,您最终(就像 OP)出现大量错误。
见问题 R cannot be resolved - android error :

  • 确保SDK目录下的工具有执行权限
  • 转到 Project > Build all(并选择“Build Automatically

R is an automatically generated class that holds the constants used to identify your resources.


根据 OP 自己的报告 (GuyNoir),整个 Eclipse Android 项目出现大量编译错误的其他原因:

The code I downloaded from git was the newest version, and probably for Android 2.1, where the SDK I'm was creating it under was Android 1.5.
So I'll need to download older code or install the latest SDK.

关于java - 从 Android Git 创建 Eclipse 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2211689/

相关文章:

java - JnetPcap无线接口(interface)

android - 在 Kotlin 中测试私有(private)方法

java - 在 Eclipse 中将 XML 文件添加到 Android 项目时出错

java - 如何访问 JDA 事件监听器内的数据?

java - 如何创建自己的高效数据结构?

android - 将 Kinect 连接到安卓

java - 如何向数组添加数组?

java - 安卓 : Sting returning with null pointer exception

java - Mongodb java输入两个日期字段之间的日期

android - "No enclosing instance of type"在Android中从另一个类调用方法时出错