Malfunction
Malfunction

Reputation: 1334

Adding source files to android

Ok, i've wasted an hour trying to figure it out, even though it's something really simple.

I've downloaded some code from github. I'd like to use this in my android application. How do I go about adding it? It's not a jar file, and i tried drag dropping it and linking the files, and it didn't work. Importing and refreshing / cleaning the project didn't work.

I'm not sure where I'm going wrong. Any help is greatly appreciated!

Upvotes: 0

Views: 397

Answers (2)

Teovald
Teovald

Reputation: 4389

If this is a project you want to import in eclipse, right click on eclipse left pane (the project list), import, android project from files, select the repository folder.

If this is a library you want to use in you app, there is another step : go to the properties of your project, android tab and in the library section click on add, then select the library project.
By design, android code that contains layout resources (for example ActionBar Sherlock) can not be embedded in a jar. So you have to use it as a library project. It is very convenient though, since it allows you to look at or modify the library code very quickly.

You may also need to let Eclipse know that your library project is a library and not an app. To do so, in the same Properties/Android screen you just have to check the "is a library" checkbox.

Reference on that topic : official documentation

Upvotes: 1

Lisa Anne
Lisa Anne

Reputation: 4595

In Eclipse: File->New->Other->"Android Project from exiting Code"

Upvotes: 0

Related Questions