views:

1332

answers:

2

I've downloaded one of the open source Android Applications (the music application) from the Android git, and I'm trying to 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?

+3  A: 

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.

alt text


That being said, if after importing the project, you end up (like the OP) with tons of errors like:

alt text alt text

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.

VonC
Another step by step manual: http://osdir.com/ml/AndroidBeginners/2009-07/msg00213.html
VonC
That fixed the error. But when the project is created there are hundreds of errors related to not being able to find resources. Is there a specific way/tutorial for importing the Git android applications (not the samples).
GuyNoir
@GuyNoir : having some of the errors would help. Did you set the Android JDK location *before* importing the application?
VonC
I'm not exactly sure what you mean by that. Here's what the project looks like when it's imported. My other applications work fine, it's just this one.http://img163.imageshack.us/img163/7517/ss20100206140200.pngHere's one of the .java files:http://img163.imageshack.us/img163/4048/ss20100206140337.png
GuyNoir
@GuyNoir: "`R cannot be resolved`", right: see http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error. That should solve that problem.
VonC
Hmmm... I don't think I have the same problem. I think I found the solution though. 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'll try that.
GuyNoir
@GuyNoir: thank you for the feedback. In that kind of problem, the error messages are really key to properly identify the root cause of the issue. The "`R cannot be resolved`" was all I got from your previous pictures ;)
VonC
A: 

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

Fred Grott