Library Project does the manifest file merge?
Asked Answered
E

3

27

I am thinking of creating a core application library (a library project with all the logic), a free version)and a full version that use this library.

As I understand some things in the manifest do not merge down like permissions and activities, does the version code merge? Could I put a single version code in the library to apply to both the free and paid versions?

The second question is, my current application (The one I will turn into an Android library) depends on a library, therefore if I make it a library, as I understand it, you cannot have a library inherit from a library. How do I get around this?

Enigmatic answered 16/12, 2010 at 3:39 Comment(0)
T
21

THIS ANSWER WAS CORRECT FOR EARLIER VERSIONS OF THE ANDROID SDK BUT IS NOW OBSOLETE. SEE Hayes's ANSWER BELOW FOR MORE UP-TO-DATE INFO.

  1. The manifest file for a library project is almost totally not used. The only part that's necessary is the manifest element with a package attribute. I believe the rest of the manifest for a library project is ignored.

  2. The android tools released in Sept 2010 do support a library project referencing a library project. The docs state otherwise, but I'm pretty sure they are out-of-date.

Thicket answered 16/12, 2010 at 6:17 Comment(3)
Tried referencing a library that also references another library, and it doesn't work. The classes are not being resolved.Sites
I have no problem here referencing a library from a library. Maybe you did something wrong?Garibay
Obsolete answer. See @Hayes Haugen answer's two years later.Mummery
H
41

AndroidManifest.xml merging is supported in version 20 of the ADT tools:

"Automatic merging of library project manifest files into the including project's manifest. Enable with the manifestmerger.enabled property."

http://tools.android.com/download/adt-20-preview

You will need version 20.0.3 or newer to get it to work within Eclipse.

Release notes for ADT 21 preview has this comment:

"Fixed manifest merger to properly adapt library classes in the merged manifest."

Not sure what this means but may be worth checking out if you are having merge issues.

Horde answered 22/6, 2012 at 19:14 Comment(2)
This has been fixed in 20.0.3 (for me at least). Please reconfirm.Dish
I guess things have moved on since the original answer was accepted. This is now the correct answer as at Oct 2012Moy
T
21

THIS ANSWER WAS CORRECT FOR EARLIER VERSIONS OF THE ANDROID SDK BUT IS NOW OBSOLETE. SEE Hayes's ANSWER BELOW FOR MORE UP-TO-DATE INFO.

  1. The manifest file for a library project is almost totally not used. The only part that's necessary is the manifest element with a package attribute. I believe the rest of the manifest for a library project is ignored.

  2. The android tools released in Sept 2010 do support a library project referencing a library project. The docs state otherwise, but I'm pretty sure they are out-of-date.

Thicket answered 16/12, 2010 at 6:17 Comment(3)
Tried referencing a library that also references another library, and it doesn't work. The classes are not being resolved.Sites
I have no problem here referencing a library from a library. Maybe you did something wrong?Garibay
Obsolete answer. See @Hayes Haugen answer's two years later.Mummery
A
0

Manifests are not merged, but I recall there's an include statement in Android XMLs.

Arbitrary-level library dependence was introduced in a recent version of Android SDK IIRC.

Acton answered 16/12, 2010 at 3:48 Comment(6)
I have the most recent version of the SDK, does this mean it is ok to have libraries inheriting from libraries (Arbitrary-level library dependence)Enigmatic
In the documentation is says that "Note that a library project cannot itself reference another library project"Enigmatic
Just created a library that depends on another library, and built them. Eclipse Ganymede, Android tools v.0.9.9.v201009221407-60953 (probably even not the most recent one).Acton
What do you mean by "there's an include statement in Android XMLs"? Is there an easy way to include list of activities from AndroidManifest.xml that's in Library Project?Tragus
I was mistaken, it seems. Manifest files don't support include. Sorry.Acton
No, the include is only for layouts.Garibay

© 2022 - 2024 — McMap. All rights reserved.