0

I have a main project, it has some libs (like library-x, library-y, library-z) and a library project. In the library project I import the same libraries with the same versions of the main project (for example library-x and library-y).

When I compile the project, in my application will it duplicate my libraries or adt will take only one library if it is the same project?

Is there any way to use the project's libraries in the library project?

Thank you.

hemantsb
  • 2,049
  • 2
  • 20
  • 29
Tenaciousd93
  • 3,438
  • 4
  • 33
  • 56

1 Answers1

0

If I understood your question correctly, you can just include your dependencies in the library project and then let the library project export its dependencies. The main project then only includes the library project, but also can access its dependencies.

This can change depending on your development environment, however. With Gradle, for example, you can safely add multiple libraries from Maven and it will automatically remove duplicates.

Thrakbad
  • 2,728
  • 3
  • 23
  • 31
  • Then if I include a library in the library project the main project can access at it? If I use Gradle and I keep same lib in both project, it remove automaticaly? – Tenaciousd93 Aug 06 '13 at 08:25
  • With Eclipse, you can select whether you want to export the dependencies (make them available to other projects) in the "Java Build Path" settings under "Order and Export". I know this works, because I do it in my own projects. With Gradle you need to differentiate between Maven libraries and normal jar files in some folder. The former will never be redundant; I haven't got around to create a working setup with the latter, however. What is your build setup? – Thrakbad Aug 06 '13 at 08:35
  • I use this big main project as a "base" for other project variation. This project has private libs and library-project. Now I add another library-project to implements Google Cloud Messaging for notifications. When I click on a notification starts an activity. This activity use, for example, the asynchttp lib that is imported in the main project. I can just import this lib another timeb in library-project, but I would avoid.. If there aren't better ways, I will do so. – Tenaciousd93 Aug 06 '13 at 09:07
  • In this case you could remove the import of the asynchttp lib from your main project and just export it from your GCM library-project. I'm pretty sure it will also workk if you don't export it and just include it in the main project again. However, I don't know if the file-size of the apk will be bigger with the second approach. – Thrakbad Aug 06 '13 at 09:12
  • Ok, I will do so if I don't find better way. Thank you very much. – Tenaciousd93 Aug 07 '13 at 06:31