Posted on

Android Manifest Basics

Hey, want to talk about some of the manifest details. Especially Manifest merger, even though we have many manifests : each library has a manifest, even your app can have multiple manifests (one base and others for flavors/build types). But in the end there’s just one left. And just like during git merge, there could be conflicts in the way, let’s look at the most common that I’ve faced so far and how to fix them

Manifest Merger

Manifests are sorted by priority. Library’s ones have the lowest, build type’s the highest. If you have the same attributes declared you can get a merge conflict which you need to solve.

Android Studio does a great job by helping you in such cases. You can see the resulting manifest here

You can ether merge (if there’s no conflicts), remove (don’t include any version) or replace by using

Common Conflict

The latest manifest merge conflict I had was with the latest Facebook SDK version : 4.19.0. Before you had you declare FacebookActivity in the manifest, now it’s declared in the SDK, probably it wasn’t before. So now you don’t need to declare it and guilde doesn’t mention it any more, but if you had it from previous version and updated to the latest Facebook SDK version, then you’ll have a manifest merge conflict

This conflict appears because we declare a theme for FacebookActivity and it’s declared in the SDK itself. Android Studio suggests us to add

This solves the problem. And by the way, if you want to remove this ugly grey Facebook Progress Bar and black status bar which look like this


Another inteersting aspect in manifest is permissions. Starting with Marshmallow’s runtime permissions we have uses-permission-sdk-23 tag. It might appear like you need to declare both: regualr and sdk-23, but actually you need to declare just one of them

Sdk-23 if you want to ask for permission only starting from Marshmallow and regular if you need to ask permission from all users. Why would you want to make API specific permissions? Basically for pre M there will be no some specific permissions. Looking at this page and searching for ‘added  in API 23’ we can tell which ones we don’t need to ask on older phones, since it’s not even available there, so why confuse them with those permissions.


That’s probably it for manifest stuff today, shouldn’t be any other issues with manifests. Thanks for reading, don’t forget to subscribe, follow me on Twitter, Facebook, G+ and share with friends if you think they will benefit from it!