Wednesday, February 25, 2015

Usage of Android manifestmerger

Before going into manifestmerger, we will have questions why to merge?
Let start ...
Why to merge manifest files?
Assume we have a multiple libraries and each of them contribute Activity/Receiver/Services and many more into the application. Managing all in one manifest files makes like miserable.
To solve the above approach, we can manage their own Activity/Receiver/Services and more in their own manifest file and build time, we can combined all together.
Now, how to merge manifest file?
ADT 20.0.0 introduced new property to help in merging the manifest files, which helps in merging all the manifest files using property “manifestmerger.enabled “.

What the manifestmerger.enabled do?

It automatically merges the library project manifest files into the including project's manifest. Just by using the manifestmerger.enabled property, we can enable this feature.

We need to add this property in the project.properties file of your project.

What errors we may face?

If the configuration is done properly in the manifest file, we may face “Unknown error merging manifest” Android Manifest Merger Problem.

Solution to solve this exception:

Be clear in using of android:targetSdkVersion and android:minSdkVersion.
Your minSdkVersion of library should not be less than your project minSdkVersion and Your targetSdkVersion of library should not be more in than your project manifest file.




Thanks for reading :) 
Whether this post is helpful?

Have something to add to this post? If you have any other quick thoughts/hints that you think people will find useful? Share it in the comments.