Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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?

like image 722
Kleptine Avatar asked Feb 06 '10 02:02

Kleptine


3 Answers

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.

like image 115
VonC Avatar answered Oct 04 '22 01:10

VonC


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

like image 26
dB Wood Avatar answered Oct 04 '22 03:10

dB Wood


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

like image 24
Fred Grott Avatar answered Oct 04 '22 01:10

Fred Grott