Eclipse Android project, how to reference library within workspace?
The classical Eclipse/Java way
Add a (workspace) library
- Right click the project you want to insert in.
- Click
Properties
. - Select
Java Build Path
. - Select the
Libraries
tab.
Now, it depends how you compile your library.
So either do an Add JARs...
or an Add Class Folder
.
Choose the external
variant to use an external source.
That's it.
Add a workspace project
- Right click the project you want to insert in.
- Click
Properties
. - Select
Java Build Path
. - Select the
Projects
tab.
Click Add...
on the right side and you are done.
The additional Android way
Two steps are necessary:
- Mark the project you want to use as library project
- Reference the marked project
Mark the library project
Right click your project and select Properties
.
Select Android
on the left and tick the checkbox IsLibrary
. Done.
Reference the marked project
Right click your project and select Properties
.
Select Android
on the left and Add...
your marked project. It will be added to the list and is ready to use. Now you are able to access all classes and ressources (e.g. drawables, strings) from the referenced, marked project. Awesome, eh? :)