I am developing an Android project in eclipse. I am creating a library project that is used by a main project. Main project uses an external jar file. I want to add this external jar file to my library project and just add the jar file of library project to the main project. I have added that jar file in library project but when I compile library project its size is not changed and the external jar file is not embedded in the library project.
I mean I want to combine the library and the external jar into one library that my project can link to.
How can I do that?
Thanks,
So you want to combine the library and the external jar into one library that your project can link to? That is not possible. You cannot just combine/link two binaries (JARs) and expect them to work as one single library. Your libraries are dynamically linked and not statically, and each library is loaded in a different address space. If you want them to be as one, you need to have the source of the two libraries (your existing library and external jar) and compile them into one (that is, static linking).
Update:
Thanks Sergiu for the insight, that is quite true. The above answer was based on the precinct that a library is a binary loaded by the JRE at runtime at some memory location, and that it is formatted binary with functions/variables loaded at locations calculated by the environment – A General CS theory.
Based on your comments, I googled how to combine two JARs, and your method seems right.
Here’s another SO answer: Combine two JARs
Check out the 2nd answer, it also clarifies about the Manifest.mf file.