开发者

Create Eclipse Project from Android Git

I've downloaded one of the open source Android Applications (the music application) from the Android git, and I'm trying to开发者_C百科 create a new project from the source. Creating a new project using that existing source doesn't work giving me an "invalid description error". Any help?


You must be referring to the error message "invalid project description".

See this thread (relevant extracts below, with emphasis mine):

If you see a .project in the application you downloaded, you can try a "File" + "Import" + "Existing Projects into Workspace" and select the directory of the music sample.

But if not, using New> Android Project> Create project from existing source is the right way to do it.
Make sure to select which Android target you want (1.1 or 1.5 or 2.0):
the "new project" wizard will automatically select the right sample directory for you.
Then select "Browse" and the Music directory. It should then fill the properties at the bottom of the new android project wizard.

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?

In short:

  • 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....

See also this tutorial (for the Snake sample)

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.

Create Eclipse Project from Android Git


That being said, if after importing the project, you end up (like the OP) with tons of errors.
See question R cannot be resolved - android error:

  • make sure the tools in the SDK directory have the permission to be executed
  • go to Project > Build all (and selecting "Build Automatically"

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


Other cause for massive compilation errors all over the Eclipse Android project, as reported by the OP himself (GuyNoir):

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.


I was still getting the "invalid project description" error with the Android 2.3 SDK examples (Eclipse Helios 20100917-0705, Ubuntu 10.10). It won't import the existing projects.

WORKAROUND:

  • Place the project in a owned directory (I copied them from my SDK install at /opt/anrdroid-sdk-linux_86) to my ~/workspace directory.
  • Using the Java Package Explorer view /New/JavaProject, enter the project directory name (you should see the existing files on the 2nd wizard page)
  • In Package Manager, select the new project: Android Tools/Convert to Android Project
  • Create the /gen project directory if it doesn't exist (fails without it)
  • Android Tools/Fix Project Properties
  • Main Menu/Project/Build Project

I've had good luck getting the example Apps to compile and run this way


Resources should realign with what you imported it often takes the ADT eclipse plugin some time ro recognize sometimes depending upon size of the project

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜