8

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?

Kleptine
  • 5,032
  • 15
  • 55
  • 79

3 Answers3

15

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.

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


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.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Another step by step manual: http://osdir.com/ml/AndroidBeginners/2009-07/msg00213.html – VonC Feb 06 '10 at 10:33
  • 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). – Kleptine Feb 06 '10 at 18:48
  • @GuyNoir : having some of the errors would help. Did you set the Android JDK location *before* importing the application? – VonC Feb 06 '10 at 18:57
  • 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.png Here's one of the .java files: http://img163.imageshack.us/img163/4048/ss20100206140337.png – Kleptine Feb 06 '10 at 19:03
  • @GuyNoir: "`R cannot be resolved`", right: see http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error. That should solve that problem. – VonC Feb 06 '10 at 19:12
  • 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. – Kleptine Feb 06 '10 at 23:23
  • @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 Feb 06 '10 at 23:36
3

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

idbrii
  • 9,440
  • 5
  • 50
  • 93
dB Wood
  • 31
  • 1
1

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
  • 71
  • 3