0

I have an already existing android project, and now I want to use this project as a library project for another project of mine.

How can I achieve this ?

OcuS
  • 5,320
  • 3
  • 36
  • 45
Ankit
  • 4,426
  • 7
  • 45
  • 62
  • 1
    Possible uplicate http://stackoverflow.com/questions/14598038/how-to-convert-an-android-project-into-a-library-project-in-android – OcuS Jun 04 '13 at 08:58
  • Just add them in the same workspace, and go to project properties. In the Android tab, add it as a library! – Kunal S. Kushwah Jun 04 '13 at 08:58

1 Answers1

2

Assuming you have imported both the projects in the same workspace,

Right Click on your new project -> Properties -> Android -> Library -> Select the existing project as a library for the new project

Also, for the existing project :

Right click on your existing project -> Properties -> Android -> Check 'Is library' check box to enable the project to be used as a library

Swayam
  • 16,294
  • 14
  • 64
  • 102
  • I did exactly the same, but I am facing an error. Let's say the project that I marked as library is "SampleProject" & the project where I want to use it is "HelloWorld". I followed the exat same steps, but HelloWorld project won't compile. Error reads "the container library project refrences non-existing library". – Ankit Jun 04 '13 at 09:21
  • 1
    That seems like eclipse making life hard for you. Remove the reference. Close HelloWorld. Reopen HelloWorld and the add the reference again. Dont forget to clean the project too. – Swayam Jun 04 '13 at 09:40
  • Restarted eclipse and problem is fixed. – Ankit Jun 05 '13 at 05:16
  • 1
    Haha. Like I said, eclipse does indeed make life hard for you sometimes. Anyway, great that it's working now. Good luck ahead! :) – Swayam Jun 05 '13 at 05:41