2 lines in Manifest to remove before sharing your Android Library

It’s fun to make Android library for others. Some tutorials you could refers to. Just made a simple one. Then try it on some existing applications, and learn about this.

What Android Studio auto generates for you

When you create a module of new Android Library, it will generate AndroidManifest.xml which contains

<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">

In most circumstances it is fine that your library has the above. This is because given most applications have allowBackup and supportsRtl as true since it’s the default. Hence these applications could include your library without any hiccup.

When the Application Manifest differs

Unfortunately some application has a different setting for either allowBackup or supportsRtl or even both. And when that happens, they will have the error similar to below when they include your library.

Manifest merger failed : Attribute application@supportsRtl value=(false) from AndroidManifest.xml:23:9-36
is also present at [com.mylibrarypackage:mylibrary:1.0.0] AndroidManifest.xml:14:9-35 value=(true).
Suggestion: add…

--

--